Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #83596
| References | <54b35c3d$0$2738$c3e8da3$76491128@news.astraweb.com> |
|---|---|
| From | Ian Kelly <ian.g.kelly@gmail.com> |
| Date | 2015-01-11 23:00 -0700 |
| Subject | Re: importing os.path -- why does it work? |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.17607.1421042495.18130.python-list@python.org> (permalink) |
On Sun, Jan 11, 2015 at 10:31 PM, Steven D'Aprano <steve@pearwood.info> wrote: > But bizarrely, you can import os.path this way! > > py> import os.path > py> os.path > <module 'posixpath' from '/usr/local/lib/python3.3/posixpath.py'> > py> os.__package__ > '' > > > > By what wizardry does this work? By the wizardry of adding an entry to sys.modules. https://hg.python.org/cpython/file/8b3c609f3f73/Lib/os.py#l112
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
importing os.path -- why does it work? Steven D'Aprano <steve@pearwood.info> - 2015-01-12 05:31 +0000
Re: importing os.path -- why does it work? Ian Kelly <ian.g.kelly@gmail.com> - 2015-01-11 23:00 -0700
Re: importing os.path -- why does it work? Steven D'Aprano <steve@pearwood.info> - 2015-01-12 07:21 +0000
csiph-web