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' #324

Closed
stuartcampbell opened this issue May 6, 2014 · 1 comment
Closed

Name clashes with 'open' #324

stuartcampbell opened this issue May 6, 2014 · 1 comment

Comments

@stuartcampbell
Copy link
Member

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

This issue has been moved to nexusformat/python-nxs#7. Please continue commenting there.

@nexusformat nexusformat locked and limited conversation to collaborators Dec 15, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants