ipython / ipython/ipykernel

Tab completion ignores __all__

Offen
#129 22 Kommentare 3 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Python
Sterne
734
Forks
412
Ø Merge
1 T. 5 Std.
Gemergte PRs (30 T.)
8

Beschreibung

The [Python docs](https://docs.python.org/2/reference/simple_stmts.html?highlight=__all__#the-import-statement) describe "public names" as being defined by `__all__` where it exists. It would be helpful if this rule was respected by the Python kernel to avoid module authors that want to provide helpful tab-completion having to obfuscate imports, etc. with leading underscores. NB. This use case is explicitly recognised in the Python docs:

> ... to avoid accidentally exporting items that are not part of the API (such as library modules which were imported and used within the module).

WIth the current kernel behaviour, code such as:

``` python
from __future__ import (division, print_function)
from six.moves import (filter, map)

import contextlib

__all__ = ['my_api']

def my_api():
...
```

needs to become:

``` python
from __future__ import (division as _, print_function as _)
from six.moves import (filter as _filter, map as _map)

import contextlib as _contextlib

__all__ = ['my_api']

def my_api():
...
```

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.