[Python-Dev] Dropping __init__.py requirement for subpackages

André Malo nd at perlig.de
Wed Apr 26 21:05:35 CEST 2006


* Guido van Rossum wrote:

[me]
> > Actually I have no problems with the change from inside python, but
> > from the POV of tools, which walk through the directories,
> > collecting/separating python packages and/or supplemental data
> > directories. It's an explicit vs. implicit issue, where implicit would
> > mean "kind of heuristics" from now on. IMHO it's going to break
> > existing stuff [1] and should at least not be done in such a rush.
> >
> > nd
> >
> > [1] Well, it does break some of mine ;-)

[Guido]
> Can you elaborate? You could always keep the __init__.py files, you
> know...

Okay, here's an example. It's about a non-existant __init__.py, though ;-)
I have a test system which collects the test suites from one or more 
packages automatically by walking through the tree. Now there are 
subdirectories which explicitly are not packages (no __init__.py), but do 
contain some python files (helper scripts, spawned for particular tests). 
The test collector doesn't consider now these subdirectories at all, but in 
future it would need to (because it should search like python itself).

Another point is that one can even hide supplementary packages within such a 
subdirectory. It's only visible to scripts inside the dir (I admit, that 
the latter is not a real usecase, just a thought that came up while writing 
this up).

Anyway: sure, one could tweak the naming - just not for existing a.k.a. 
already released stuff. It's not very nice to force that, too ;-)

nd
-- 
If God intended people to be naked, they would be born that way.
  -- Oscar Wilde


More information about the Python-Dev mailing list