A RetroSearch Logo

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

Search Query:

Showing content from http://mail.python.org/pipermail/python-list/2005-September/305184.html below:

Duplicating Modules

Duplicating ModulesSteven D'Aprano steve at REMOVETHIScyber.com.au
Fri Sep 30 23:57:34 EDT 2005
On Fri, 30 Sep 2005 19:52:56 +0200, Misto . wrote:

> There is a way to dumplicate a module ?

[snip]

> P.S: I know that there is some design Issue here, but my boss says no :)

It depends on what you are expecting to do with the duplicated module. If
all you need is to access the same module from two different names, you
can do this:

py> import sys
py> my_boss_is_an_idiot = sys  # *grins*
py> my_boss_is_an_idiot.version
'2.3.3 (#1, May  7 2004, 10:31:40) \n[GCC 3.3.3 20040412 (Red Hat Linux
3.3.3-7)]'


But keep in mind that using this method, sys and my_boss_is_an_idiot are
merely different names for the same underlying module. Change one and you
change the other.

I'm curious... I don't expect you to comment on your boss' mental state,
but how/why do you need to duplicate the module?


-- 
Steven.


More information about the Python-list mailing list

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