newbie questions about imports, threads, and optimizations
Oleg Broytmann
phd at phd.russ.ru
Thu Jun 29 09:26:00 EDT 2000
On Wed, 28 Jun 2000, Bryce Sellers wrote:
> First, is there a way to do something like this:
>
> import string, mystring
> m = 'string'
> `m`.captalize('hello')
> m='mystring'
> `m`.capitalize('hello')
You are very close :)
m = string
m.captalize('hello')
In python, every name (EVERY NAME!) is just a name of variable
containing a pointer to an object. When you import a module, there is
nothing magical in its name - it is just a variable containing a pointer to
the module. Copy the pointer (m = string) and use the new variable that now
holds the same pointer.
Oleg. (All opinions are mine and not of my employer)
----
Oleg Broytmann Foundation for Effective Policies phd at phd.russ.ru
Programmers don't die, they just GOSUB without RETURN.
More information about the Python-list
mailing list