[Python-Dev] Single .py file contains submodule?

holger krekel pyth@devel.trillke.net
Fri, 31 May 2002 10:37:03 +0200


Kevin Butler wrote:
> Guido wrote:
>  > (Barry prefers that there's only one class per file; fortunately I
>  > don't have that hangup. :-)
> 
> So how about a single .py file containing a module and one-or-more submodules? 

I have been asking this myself, too. I definitely see an advantage
beeing able to put modules and submodules in one file. IMO it's a 
logical structure IMO and it is easier to distribute. If you just want to send 
someone a module to work/test with (without requiring setup.py etc.pp.)
a file is a nicer unit. The next better step involves creating a
(distutils-) package. But i don't always want to create packages for a module.

Maybe there is an elegant way to achieve this? I don't find Kevin's
code too hard to understand, btw...

    holger