import random module

Ben Finney bignose+hates-spam at benfinney.id.au
Wed Mar 22 17:31:10 EST 2006


"DataSmash" <rdh at new.rr.com> writes:
> * random.py:
>
> import random

Now that you've tripped over this ambiguity of Python's current
'import' behaviour, you may be interested to know that the behaviour
will change to solve this:

    <URL:http://www.python.org/dev/peps/pep-0328/>

In brief: Python will disambiguate relative imports (from the current
package) from absolute imports (from the sys.path), by only allowing
relative imports by a specific syntax; the default import behaviour
will be absolute import.

In line with Python's procedure for introducing changes to behaviour,
the new behaviour will be introduced in backward-compatible stages. In
Python 2.5, a 'from __future__ import absolute_import' will enable the
import behaviour specified in the PEP; in Python 2.6, the Python 2.4
behaviour will occur but raise a DeprecationWarning; in Python 2.7,
the import behaviour specified in the PEP will be the default.

-- 
 \         "I may disagree with what you say, but I will defend to the |
  `\    death your right to mis-attribute this quote to Voltaire."  -- |
_o__)                      Avram Grumer, rec.arts.sf.written, May 2000 |
Ben Finney




More information about the Python-list mailing list