At 03:04 AM 7/22/2011 +0200, Antoine Pitrou wrote: >The additional confusion lies in the fact that a module can be >shadowed by something which is not a module (a mere global >variable). I find it rather baffling. If you move x.py to x/__init__.py, it does *exactly the same thing* in current versions of Python: Python 2.7.1 (r271:86832, Nov 27 2010, 18:30:46) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> from x import y >>> import x.y >>> x.y <module 'x.y' from 'x\y.py'> >>> y 5 The PEP does nothing new or different here. If something is baffling you, it's the behavior of "from ... import", not the actual importing process. "from x import y" means "import x; y = x.y". The PEP does not propose we change this. ;-)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4