[Python-Dev] Using relative imports in std lib packages ([Python-checkins] r43033 (original) (raw)

[Python-Dev] Using relative imports in std lib packages ([Python-checkins] r43033 - in python/trunk/Lib: distutils/sysconfig.py encodings/__init__.py)

M.-A. Lemburg mal at egenix.com
Wed Mar 15 10:22:50 CET 2006


guido.van.rossum wrote:

Author: guido.van.rossum Date: Wed Mar 15 05:33:54 2006 New Revision: 43033

Modified: python/trunk/Lib/distutils/sysconfig.py python/trunk/Lib/encodings/init.py Log: Use relative imports in a few places where I noticed the need. (Ideally, all packages in Python 2.5 will use the relative import syntax for all their relative import needs.)

Instead of adding relative imports to packages in the standard lib, I'd suggest to use absolute imports instead. These are much easier to manage, maintain and read.

There's also no "need" for relative imports in std lib packages since these won't be subject to possible relocation.

Modified: python/trunk/Lib/distutils/sysconfig.py ============================================================================== --- python/trunk/Lib/distutils/sysconfig.py (original) +++ python/trunk/Lib/distutils/sysconfig.py Wed Mar 15 05:33:54 2006 @@ -16,7 +16,7 @@ import string import sys

-from errors import DistutilsPlatformError +from .errors import DistutilsPlatformError # These are needed in a couple of spots, so just compute them once. PREFIX = os.path.normpath(sys.prefix) Modified: python/trunk/Lib/encodings/init.py ============================================================================== --- python/trunk/Lib/encodings/init.py (original) +++ python/trunk/Lib/encodings/init.py Wed Mar 15 05:33:54 2006 @@ -27,7 +27,8 @@ """#" -import codecs, types, aliases +import codecs, types +from . import aliases cache = {} unknown = '--unknown--'


Python-checkins mailing list Python-checkins at python.org http://mail.python.org/mailman/listinfo/python-checkins

-- Marc-Andre Lemburg eGenix.com

Professional Python Services directly from the Source (#1, Mar 15 2006)

Python/Zope Consulting and Support ... http://www.egenix.com/ mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/


::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! ::::



More information about the Python-Dev mailing list