Re: Duplicating Modules

2005-09-30 Thread Steven D'Aprano
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

Re: Duplicating Modules

2005-09-30 Thread Dave Benjamin
Misto . wrote: > Hi folks! > > Short: > > There is a way to dumplicate a module ? Here's one way... it doesn't quite work with modules inside of packages, unfortunately, but it does avoid defeating module caching and tries to keep sys.modules in a predictable state. I don't know what the thre

Re: Duplicating Modules

2005-09-30 Thread Peter Otten
kimes wrote: > Why don't you do like this.. > > import module > import mudule as module2 >>> import module as a >>> import module as b >>> b is a True You have to remove the module from the cache before the second import: >>> import sys >>> import module as a >>> del sys.modules["module"] >>>

Re: Duplicating Modules

2005-09-30 Thread kimes
Why don't you do like this.. import module import mudule as module2 -- http://mail.python.org/mailman/listinfo/python-list

Duplicating Modules

2005-09-30 Thread Misto .
Hi folks! Short: There is a way to dumplicate a module ? I tried copy.deepcopy(module) but hangs with an error (also with standard modules ). The only solution that I have by now is creating two files and importing them. I.E: > cp module.py module1.py >> import module >> import module1 Any