Z
Zac Burns
Currently it is possible to import a file of one path to more than one
'instance' of a module. One notable example is "import __init__" from
a package. See http://stackoverflow.com/questions/436497/python-import-the-containing-package
This recently caused a devastating bug in some of my code. What I have
is support for the Perforce global options as a context for a perforce
module. http://www.perforce.com/perforce/doc.072/manuals/cmdref/o.gopts.html#1040647
This way one can call functions that call many perforce command and
have them execute on a different client for example.
So, in module A and module B both imported the Perforce module, but
they turned out not to be the same module. Module A did "with
Perforce.GlobalOptions(client=client): B.function()"
B.function did not receive the new GlobalOptions because of this
problem. As a result important files on the original client were
overwritten (OUCH).
I would like to propose that it be made impossible in the Python
source to import two instances of the same module.
--
Zachary Burns
(407)590-4814
Aim - Zac256FL
Production Engineer (Digital Overlord)
Zindagi Games
'instance' of a module. One notable example is "import __init__" from
a package. See http://stackoverflow.com/questions/436497/python-import-the-containing-package
This recently caused a devastating bug in some of my code. What I have
is support for the Perforce global options as a context for a perforce
module. http://www.perforce.com/perforce/doc.072/manuals/cmdref/o.gopts.html#1040647
This way one can call functions that call many perforce command and
have them execute on a different client for example.
So, in module A and module B both imported the Perforce module, but
they turned out not to be the same module. Module A did "with
Perforce.GlobalOptions(client=client): B.function()"
B.function did not receive the new GlobalOptions because of this
problem. As a result important files on the original client were
overwritten (OUCH).
I would like to propose that it be made impossible in the Python
source to import two instances of the same module.
--
Zachary Burns
(407)590-4814
Aim - Zac256FL
Production Engineer (Digital Overlord)
Zindagi Games