[Python-Dev] Writing importers and path hooks (original) (raw)
Nick Coghlan ncoghlan at gmail.com
Fri Mar 29 21:41:19 CET 2013
- Previous message: [Python-Dev] Writing importers and path hooks
- Next message: [Python-Dev] Post-PyCon updates to PyParallel
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Fri, Mar 29, 2013 at 3:39 AM, Brett Cannon <brett at python.org> wrote:
To tell if a module is a package, you should do either ``if mod.name == mod.package
or
if hasattr(mod, 'path')``.
The second of those is actually a bit more reliable. As with many import quirks, the answer to "But why?" is "Because main" :P
Cheers, Nick.
-- Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
- Previous message: [Python-Dev] Writing importers and path hooks
- Next message: [Python-Dev] Post-PyCon updates to PyParallel
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]