PyWart: "Python's import statement and the history of external dependencies"

Tim Chase python.list at
Fri Nov 21 11:26:27 CET 2014

On 2014-11-20 19:53, Rick Johnson wrote:
> FOR INSTANCE: Let's say i write a module that presents a
> reusable GUI calendar widget, and then i name the module
> "".
> Then Later, when i try to import *MY* GUI widget named
> "calendar", i will not get *MY* calendar widget, no, i will
> get the Python calendar module.
> The reason Python finds the library module instead of my
> module is because the Python library is higher in search
> path than my module.

What messed-up version of Python are you running?  Or did you fail to
test your conjecture?

$ cat >
print("This is my local")
$ cat >
import calendar
$ python2 
This is my local
['__builtins__', '__doc__', '__file__', '__name__', '__package__', 'x']
$ python3
This is my local
['__builtins__', '__cached__', '__doc__', '__file__', '__name__', '__package__', 'x']

It finds my local module, not the system "calendar" module.


More information about the Python-list mailing list