ipython / ipython/ipython

edge cases with "ed" magic

Open
#7,240 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
16.8k
Forks
4.5k
Avg merge
1d 2h
Merged PRs (30d)
6

Description

**Tab completion includes builtins, keywords, aliases**

```
In [1]: ed while # note: completes automatically from "ed whi"
WARNING: Argument given (while) can't be found as a variable or as a filename.

In [2]: ed UnicodeDecodeError
WARNING: The file where `` was defined cannot be read or found.

In [3]: ed %alias
WARNING: Argument given (%alias) can't be found as a variable or as a filename.
```

I think the first two should not be in tab completion data (as they are not editable) and the third command should actually work as written, possibly with "ed alias" working as well.

**Mysteriously uneditable objects**

This works as expected

```
In [1]: tmp=get_ipython().magics_manager.magics['line']['system']
In [2]: ed tmp
```

This does not:

```
In [50]: ed get_ipython().magics_manager.magics['line']['system']
WARNING: Argument given (ip.magics_manager.magics[line][system]) can't be found as a variable or as a filename.
```

It would make sense if "ed" refuses to evaluate any complex expressions, but "ed get_ipython().magics_manager" also works as you would expect. If callables are ok I would expect dictionary access to also work.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.