[Python-Dev] Dropping init.py requirement for subpackages (original) (raw)
Guido van Rossum guido at python.org
Thu Apr 27 01:57:13 CEST 2006
- Previous message: [Python-Dev] Dropping __init__.py requirement for subpackages
- Next message: [Python-Dev] Dropping __init__.py requirement for subpackages
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 4/26/06, Delaney, Timothy (Tim) <tdelaney at avaya.com> wrote:
Potential packages later in the path won't be warned about. If you're trying to resolve import problems, it's just as likely that the package you really want is later in sys.path than earlier.
But module hiding is a feature, and anyway, we're not going to continue to search sys.path after we've found a valid match (imagine doing this on every successful import!), so you're not going to get warnings about those either way.
Obviously in the case that you get an ImportError this goes away.
Right.
> Is it also useful to distinguish a subpackage from a non-subpackage?
Possibly. Perhaps it would be useful to have
ispackage(dirname)
,isrootpackage(dirname)
andissubpackage(dirname)
functions somewhere (pkgutils?).
YAGNI. Also note that not all modules or packages are represented by pathnames -- they could live in zip files, or be accessed via whatever other magic an import handler users.
(Thomas's warning won't happen in those cases BTW -- it only affects the default import handler.)
-- --Guido van Rossum (home page: http://www.python.org/~guido/)
- Previous message: [Python-Dev] Dropping __init__.py requirement for subpackages
- Next message: [Python-Dev] Dropping __init__.py requirement for subpackages
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]