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

Tim Peters tim.one@comcast.net
Fri, 31 May 2002 11:31:51 -0400


[holger krekel]
> I have been asking this myself, too. I definitely see an advantage
> beeing able to put modules and submodules in one file.

[Guido]
> Trust me.  Don't go there.

In Perl you spell this "package NAME;".  All "dynamic" bindings from then
until the next package statement (or end of enclosing block, etc -- it's
Perl <wink>) then end up in the NAME namespace.  This is also how you
declare a class in Perl.  This is what it leads to <wink>:

    If you have a package called m, s, or y, then you can't use the
    qualified form of an identifier because it would be instead
    interpreted as a pattern match, a substitution, or a transliteration.