Module Conflicts

Ivan Illarionov ivan.illarionov at gmail.com
Thu Apr 10 16:31:08 EDT 2008


On Apr 10, 2:33 am, Jose <jfgome... at gmail.com> wrote:
> I have a module named math.py in a package with some class
> definitions.  I am trying to import the standard python math module
> inside of math.py but It seems to be importing itself.  Is there any
> way around this problem without renaming my math.py file?

Yes, if you are using Python 2.5

from __future__ import absolute import

after this `import math` will always import standard math module and
`from . import math` will import your module.

--
Ivan



More information about the Python-list mailing list