Module name conflict with standard library

Michele Simionato michele.simionato at gmail.com
Sun Sep 5 09:32:38 CEST 2004


Felix Wiemann <Felix.Wiemann at gmx.net> wrote in message news:<87k6v9o8cg.fsf at news2.ososo.de>...
> Hi!
> 
> I want to create a module myproject.ui.curses, which needs to import the
> curses library.
> 
> However, if I just write ``import curses``, the module imports *itself*
> instead of the standard library's curses module.
> 
> Is there any (reliable) way to access a module of the standard library
> if the names conflict as in this case?
> 
> Thank you in advance,
> Felix Wiemann

Dunno. I guess that when PEP328 will be fully implemented (this is NOT the
case in 2.4.a3)

from __future__ import absolute_import
import curses

will do the right thing, importing the standard library module and not
itself (which should happen with "import .curses").

Am I correct? I do really really like PEP328 since I was bitten by
this kind of problems myself in the past. Will it be implemented fully
in time for 2.4.b1?


     Michele Simionato



More information about the Python-list mailing list