En Sun, 01 Nov 2009 19:01:42 -0300, MRAB <pyt...@mrabarnett.plus.com> escribió:
Gabriel Genellina wrote:

One way to avoid name clashes would be to put the entire standard
library under a package; a program that wants the standard re
module would write "import std.re" instead of "import re", or
something similar.
 You could do it in a backwards compatible way, by adding the std
package directory into the path.
 Unfortunately you can't, at least not without some special treatment
of the std package. One of the undocumented rules of the import
system is that you must not have more than one way to refer to the
same module (in this case, std.re and re). [...]
Couldn't the entry in sys.modules be where the module was found, so that
if 're' was found in 'std' then the entry is 'std.re' even if the import
said just 're'?

What about a later 'import re'? 're' would not be found in sys.modules then. In any case, it requires a change in the current behavior, a PEP, and a lot of discussion...

--
Gabriel Genellina

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to