Creating classes and objects more than once?

Ben Finney bignose+hates-spam at
Fri Nov 28 21:59:06 CET 2008

Carl Banks <pavlovevidence at> writes:

> On Nov 28, 3:15 am, Ben Finney <bignose+hates-s... at>
> wrote:
> > This is resolved in the Python 2.x series by implementing PEP 328
> > <URL:>, such that the
> > search path for ‘import’ does *not* contain the current directory,
> > and requiring relative-to-the-current-directory imports to be
> > explicitly requested.
> PEP 328 doesn't say anything about that. Using Python 2.5, which PEP
> 328 claims implements this change, I see the same behavior that
> Victor Kerkez sees. My sys.path[0] is still the empty string,
> meaning that Python does start its import search from the current
> directory.

In Python 2.5, the PEP is implemented to the point that the absolute
import behaviour is available by adding a ‘from __future__ import
absolute_import’. Without that, yes, you will see the same behaviour
as reported by Victor.

The schedule of implementing significant changes like this is
standardised for Python (by PEP 5), and the timeline is explicitly
documented in the relevant section of PEP 328:


    In Python 2.5, you must enable the new absolute import behavior with

    from __future__ import absolute_import

    You may use relative imports freely. In Python 2.6, any import
    statement that results in an intra-package import will raise
    DeprecationWarning (this also applies to from <> import that fails
    to use the relative import syntax). In Python 2.7, import will
    always be an absolute import (and the __future__ directive will no
    longer be needed).

 \         “Pinky, are you pondering what I'm pondering?” “I think so, |
  `\   Brain, but if it was only supposed to be a three hour tour, why |
_o__)   did the Howells bring all their money?” —_Pinky and The Brain_ |
Ben Finney

More information about the Python-list mailing list