Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid name clashes with imported submodules and subpackages #141

Open
tovrstra opened this issue Jul 8, 2016 · 1 comment
Open

Avoid name clashes with imported submodules and subpackages #141

tovrstra opened this issue Jul 8, 2016 · 1 comment
Assignees
Labels

Comments

@tovrstra
Copy link
Member

tovrstra commented Jul 8, 2016

When you do

from horton import *
grid = ...

there is a name collision that gets picked up by PyLint. One way to avoid this, is to add the following code to every __init__.py file:

from types import ModuleType
for key, val in globals().items():
    if isinstance(val, ModuleType):
        del globals()[key]
del ModuleType
@tovrstra tovrstra added the QA label Jul 8, 2016
@tovrstra tovrstra added this to the 2.1.0 milestone Jul 8, 2016
@tovrstra
Copy link
Member Author

tovrstra commented Jul 8, 2016

P.S. This code can be put in a function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant