[Python-Dev] Dropping __init__.py requirement for subpackages
Phillip J. Eby
pje at telecommunity.com
Thu Apr 27 02:05:16 CEST 2006
At 04:57 PM 4/26/2006 -0700, Guido van Rossum wrote:
>On 4/26/06, Delaney, Timothy (Tim) <tdelaney at avaya.com> wrote:
> > Possibly. Perhaps it would be useful to have `is_package(dirname)`,
> > `is_rootpackage(dirname)` and `is_subpackage(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.
FYI, pkgutil in 2.5 has utilities to walk a package tree, starting from
sys.path or a package __path__, and it's PEP 302 compliant. pydoc now uses
this in place of directory inspection, so that documenting zipped packages
works correctly.
These functions aren't documented yet, though, and probably won't be until
next week at the earliest.
More information about the Python-Dev
mailing list