On Tue, Nov 09, 2010 at 01:49:01PM -0500, Tres Seaver wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > On 11/08/2010 06:26 PM, Bobby Impollonia wrote: > > > This does hurt because anyone who was relying on "import *" to get a > > name which is now omitted from __all__ is going to upgrade and find > > their program failing with NameErrors. This is a backwards compatible > > change and shouldn't happen without a deprecation warning first. > > Outside an interactive prompt, anyone using "from foo import *" has set > themselves and their users up to lose anyway. > > That syntax is the single worst misfeature in all of Python. It impairs > readability and discoverability for *no* benefit beyond one-time typing > convenience. Module writers who compound the error by expecting to be > imported this way, thereby bogarting the global namespace for their own > purposes, should be fish-slapped. ;) > I think there's a valid case for bogarting the namespace in this instance, but let me know if there's a better way to do it::
# Method to use system libraries if available, otherwise use a bundled copy, # aka: make both system packagers and developers happy:: Relevant directories and files for this module:: + foo/ +- __init__.py ++ compat/ +- __init__.py ++ bar/ +- __init__.py +- _bar.py foo/compat/bar/_bar.py is a bundled module. foo/compat/bar/__init__.py has: try: from bar import * from bar import __all__ except ImportError:: from foo.compat.bar._bar import * from foo.compat.bar._bar import __all__ -Toshio
pgp2MughtFdu4.pgp
Description: PGP signature
_______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com