
Sorry I just tried to help understand why it is wrong idea. :) But (and sorry it is another story) what surprised me during my analysis of this problem is that import variable from module is more likely unpacking value than getting access to module's variable. my_test.py --------- VAR = 1 def setter(a): global VAR VAR = a def getter(): return VAR -------- from my_test import VAR, setter, getter print(VAR) # 1 print(getter()) # 1 setter(7) print(VAR) # 1 ! print(getter()) # 7 from my_test import VAR print(VAR) # 7 ! The more I understand python the more I see that I don't understand enough. :) 2016-05-29 19:23 GMT+02:00, Guido van Rossum <guido@python.org>:
Any idea using import syntax or even syntax similar to import is dead. Import is about modules and needs to stay about that.
On Sun, May 29, 2016 at 10:10 AM, Pavol Lisy <pavol.lisy@gmail.com> wrote:
I see backward compatibility problem with import :
sys = dict(version_info=4.0) from sys import version_info
This is legal and using import for unpacking dict could change this behavior.
In case we put higher priority to import from module then unexpected module in PYTHONPATH could change unpacked value. Sort of problem not easy to found. From library maintainer point of view not easy to avoid too. _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/
-- --Guido van Rossum (python.org/~guido)