[Python-checkins] r53800 - in python/trunk: Lib/encodings/__init__.py Misc/NEWS

Brett Cannon brett at python.org
Fri Feb 16 20:23:27 CET 2007


On 2/16/07, M.-A. Lemburg <mal at egenix.com> wrote:
> On 2007-02-16 00:51, Brett Cannon wrote:
> > On 2/15/07, M.-A. Lemburg <mal at egenix.com> wrote:
> >> On 2007-02-15 23:54, brett.cannon wrote:
> >>> Author: brett.cannon
> >>> Date: Thu Feb 15 23:54:39 2007
> >>> New Revision: 53800
> >>>
> >>> Modified:
> >>>    python/trunk/Lib/encodings/__init__.py
> >>>    python/trunk/Misc/NEWS
> >>> Log:
> >>> Update the encoding package's search function to use absolute imports when
> >>> calling __import__.  This helps make the expected search locations for encoding
> >>> modules be more explicit.
> >> Your change does not make the import absolute - to the contrary: we
> >> now have a relative import.
> >>
> >
> > Right, but I just associate it with the absolute import PEP and the
> > term.  Probably could have called it a "new-style import" or
> > something.
> >
> >> Please change that back to the original scheme which is indeed an
> >> absolute import.
> >
> > Why?  What's wrong with a relative import?
>
> Whenever possible we should use absolute imports. Relative imports
> are really only necessary when you want to make packages relocatable
> which is not the case for the encodings package.
>

True, but my motivation was to enforce importing from the 'encodings'
package to prevent people from importing modules with side-effects
that are not in the package.

But absolute imports do the same thing, so I am running regrtest and
then will check in an absolute import once that is done.

-Brett


More information about the Python-checkins mailing list