[Python-Dev] intra-package mutual imports fail: "from <pkg> import <mod>"

Gisle Aas gisle@ActiveState.com
02 Jun 2002 08:40:49 -0700


Matthias Urlichs <smurf@noris.de> writes:

> Since this addition is by reference to the actual object and not to
> the symbol's name in the other module, a concept which Python doesn't
> have (use Perl if you want this...)

Perl doesn't add references to names.  It imports direct reference as
well.  The difference is that perl will create the named object in the
exporting package when it is imported, if the exporting package's init
code has not executed yet.

In Perl this works because we at import time know if we are importing
a variable (and what kind) or a function, and later assignments to
variables or redefinitions of functions mutate the object in-place.

Regards,
Gisle Aas