[Python-Dev] package attribute (original) (raw)
Andrew Svetlov andrew.svetlov at gmail.com
Fri May 21 20🔞00 CEST 2010
- Previous message: [Python-Dev] Summary of Python tracker Issues
- Next message: [Python-Dev] __package__ attribute
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
What are expected values for module.package? I see two different behaviors: importlib and standard python import. importlib processes package pretty simple and clean:
- for toplevel modules package is empty string
- for packages it's package name
- for modules inside packages it's again package name
Standard import follows another strategy:
- it tries to setup package only in case of relative import (see first 'if' in import.c:get_parent)
- otherwise package is untouched and None by default.
For me importlib's way is better. I don't see any PEP specifying package behavior.
- Previous message: [Python-Dev] Summary of Python tracker Issues
- Next message: [Python-Dev] __package__ attribute
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]