[issue2751] Regression for executing packages
Rene Dudfield
report at bugs.python.org
Fri Jul 10 07:21:42 CEST 2009
Rene Dudfield <illume at users.sourceforge.net> added the comment:
hello,
thanks for the explanation of why it's that way.
Any ideas of a work around?
python2.5 has been out for ages now. Even if it was an accident, it's
the behavior people expect, and it's still a regression.
Also, why should it matter if a module is a package or a module?
Note how pygame.tests has a type of module, and not of package:
>>> import pygame.tests
>>> type(pygame.tests)
<type 'module'>
Even though it is a package, python calls its type a module. This has
been true for a long time (at least as far back as python2.3).
Because it's a regression, I think this bug should be reopened.
To illustrate why it causes problems, here is part of the documentation
mentioning the __main__.
"""
You can do a self test with:
python -m pygame.tests
Or with python2.6 do:
python -m pygame.tests.__main__
See a list of examples...
python -m pygame.examples
Or with python2.6,
python -m pygame.examples.__main__
"""
It's twice as long, and I doubt anyone will remember the __main__ part.
People used to running their programs with -m now have broken programs
with python2.6.
Having said all that, maybe there is a work around...
One work around might be to make it into a module-module, not a
package-module. Then have the module-module load the package-module
into its namespace. I haven't tested that yet, but it might work. Will
have to go through a round of testing to see how that works out. Will
write back when I've found out the issues with that approach.
cheers,
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue2751>
_______________________________________
More information about the Python-bugs-list
mailing list