A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2002-June/024913.html below:

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

[Python-Dev] intra-package mutual imports fail: "from <pkg> import <mod>" [Python-Dev] intra-package mutual imports fail: "from <pkg> import <mod>"Matthias Urlichs smurf@noris.de
Sun, 2 Jun 2002 19:45:06 +0200
Hi,

Gisle Aas:
> > What I meant to say was: Perl shares the actual symbol table slot when you
> > import something;
> 
> Wrong.  If you do:
> 
>    package Bar;
>    use Foo qw(foo);
> 
> Then you end up with \&Bar::foo and \&Foo:foo pointing to the same
> function object, but the symbol table slots are independent.

Right, actually; we're just miscommunicating.

Let's state it differently: the situation is more like "use Foo qw($foo)"
(you can't assign to &Foo::foo). 

After the "use", \$Bar::foo and \$Foo:foo point to the same scalar
variable, thus $Foo::foo and $Bar::foo are the same variable and no longer
independent (unless a different scalar or glob reference is stored in
to *Foo::foo, but that's too much magic for a FAQ entry).

In Python, Bar.foo gets set to the contents of Foo.foo when the import
statement is processed, but the two variables are otherwise independent.

-- 
Matthias Urlichs     |     noris network AG     |     http://smurf.noris.de/




RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4