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

Name clashes with 'open' #7

Open
eugenwintersberger opened this issue Dec 15, 2015 · 1 comment
Open

Name clashes with 'open' #7

eugenwintersberger opened this issue Dec 15, 2015 · 1 comment

Comments

@eugenwintersberger
Copy link
Contributor

Original reporter: rayosborn

There is a function called 'open' in napi.py, which is included in the 'all' list. That means that doing 'from nxs import *' prevents use of the standard Python open function. Of course, wildcard imports are frowned because of just this issue but, for interactive use of the tree API, they are highly desirable, and not likely to cause problems. It would be good if people are not forced to type 'nxs.NXentry' etc. and 'open' and perhaps 'load' in tree.py, are the only problems.

There are a couple of possible solutions. One is to rename 'open' to 'nxopen', or make 'nxopen = open' and add only nxopen to the all list. The other is to put 'import napi as nx' in the package init.py so that 'from nxs import *', will still require calling 'nx.open'. The latter, however, would require people to type 'nxs.nx.open' if they just did 'import nxs'.

Comments on this are welcome.

@eugenwintersberger
Copy link
Contributor Author

This issue was originally nexusformat/code#324.

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

No branches or pull requests

1 participant