error at "import anydbm"

Peter Hansen peter at engcorp.com
Wed Jan 14 09:54:24 EST 2004


Paul McGuire wrote:
> 
> "Peter Hansen" <peter at engcorp.com> wrote in message
> news:4004482A.A66C2886 at engcorp.com...
> >
> > Generally speaking, you should try to avoid using the same names as
> > the standard library modules for your own code.
> >
> >
> This is an understandable limitation, but for new (and some not-so-new)
> Python users, it is not always obvious what module names to avoid.

This gives a good summary: http://www.python.org/doc/current/modindex.html  :-)

I think the issue actually comes up relatively rarely.  I say that partially
because problems stemming from this seem relatively infrequent in the
mailing list/newsgroup, and partly because the standard library modules
are fairly loosely coupled, and the issue above arose (I believe) only because 
one standard library module was importing another which the user didn't
know would be imported, and it matched a name he had used.

Avoiding the basic ones, like "sys", "os", and "math", along with any that
you are actually importing elsewhere in your application will probably avoid
the issue 99% of the time.

-Peter



More information about the Python-list mailing list