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

"import sux; foo = sux.to_use(foo)" should fall back on plain import when run in Py2 #1

Open
jni opened this issue Sep 12, 2014 · 2 comments

Comments

@jni
Copy link

jni commented Sep 12, 2014

This would place sux in the same category of other modules that can be used from both Python versions to write Py2/Py3-compatible code using sux. (Rather than just Py3 code using dependencies.)

Come to think of it, it might be nice for it to try plain import even in Python 3, so the code doesn't even need updating when a dependency (finally) gets updated to Python 3.

Edit: sorry for the incomplete initial post, Cmd-Enter doesn't do what I thought it did. =P

@nicois
Copy link
Owner

nicois commented Sep 12, 2014

Automatically being python2 backwards compatible sounds fine to me. Should be pretty straightforward too. In this situation, you would not need to supply a python2 virtualenv location: it would use whatever environment the main application was running in.

I am less sure about the python3 fallback. There will be some packages (e.g. boto) which partially work, and successfully import, but then fail at runtime with certain operations (like S3). This feels a bit too magical to me, and perhaps against the "explicit over implicit" pythonism.

@jni
Copy link
Author

jni commented Sep 12, 2014

I agree @nicois! As the prose hinted, the Python3 plain import was a just-baked idea. Clearly it needed a bit more time in the oven. =P

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

2 participants