migrating to packages

Hrvoje Niksic hniksic at xemacs.org
Thu Oct 4 08:33:39 CEST 2007


gherzig at fmed.uba.ar writes:

> I will expose my case quicly.
> The MYCLASES.py file contains the A class, so i can use
> from MYCLASES import A
> a = ()
>
> Using the "package mode" (wich looks fine BTW), having the simple
> MYCLASES/
>      __init__.py
>      A.py
>
> forces my (i guess) to use the
> from MYCLASES.A import A

Exactly.  Using mypackage.mymodule instead of just mymodule is the
entire *point* of a package.  That way, if someone creates another
module with using the same name (mymodule), it won't conflict with
yours.  If you don't want to change mymodule to mypackage.mymodule,
why use a package in the first place?



More information about the Python-list mailing list