PROPOSAL: Packages in Python lib

Hans Nowak ivnowa at hvision.nl
Sun May 2 05:20:18 EDT 1999


On 1 May 99, Ce'Nedra took her magical amulet and heard Paul Prescod say:

>I would like to suggest a package organization for the standard modules.
>The package directories should all be in sys.path so that older modules
>would continue to work. Import syntax could become more consistent: 
>
>from sys import types
>from sys import path
>
>This would make the shift between using the standard libraries and using
>packages easier. Consistency!
>
>Other benefits: responsibility for packages would be easier. Migration of
>packages into and out of the Python standard library would be easier.
>Platform unportable and implementation unportable code could be more
>cleanly segmented: ("compiler" is implementation unportable, "win" is
>platform unportable).
>
>Over time, (or in the move to Python 2) these packages would migrate to
>real, cohesive packages with consistent internal interfaces (i.e. among
>formats and protocols) and some consistent interfaces at the package level
>(e.g. __all__)
>
>Main benefit: It would be easier to find things in the standard library
>and to document the library!
>
>Downsides: 
>
> * slightly more typing on import.
>
>Here is a rough example of what I am thinking of:
>
>sys:
> except
> traceback
> types

Wouldn't a package sys clash with the builtin module sys? A package with the 
same name could never be imported...?

I guess this is a trivial problem, because you could call it 'system' or 
something instead. What bothers me more is the following. I have been trying 
myself to organize all kinds of modules in a package collection, and a 
problem that occurs quite often is, that a module can logically belong in 
more than one package. For instance, modules dealing with HTML parsing, do 
they belong in the Internet package, or in the Text package? (Yes, you don't 
have those packages here... but I do. :^) 

I think it will be very hard to make a package hierarchy that is logical to 
all users (or most of them). That does not mean your proposal isn't good... 
I'm just wondering how these problems will be solved.  It makes me wish that 
there was a different approach to grouping of modules... something non-
hierarchical.

Veel liefs,

+  Hans Nowak  (Zephyr Falcon)
+  Homepage (under construction): http://www.cuci.nl/~hnowak/
+  You call me a masterless man. You are wrong. I am my own master.
+  May a dead president sit on your hard body!




More information about the Python-list mailing list