How to guard against bugs like this one?

kj at
Wed Feb 3 03:35:55 CET 2010

(For reasons I don't understand Stephen Hansen's posts don't show
in my news server.  I became aware of his reply from a passing
reference in one of Terry Reedy's post.  Then I found Hansen's post
online, and then an earlier one, and pasted the relevant portion

> First, I don't shadow built in modules. Its really not very hard to avoid.

...*if* you happen to be clairvoyant.  I still don't see how the rest of us
could have followed this fine principle in the case of
prior to Python 2.6.

> Secondly, I use packages structuring my libraries, and avoid junk
> directories of a hundred some odd 'scripts'.

<small>(I feel so icky now...)</small>

> Third, I don't execute scripts in that directory structure directly, but
> instead do python -c 'from package.blah import main; main.main()' or some
> such. Usually via some short-cut, or a runner batch file.

Breathtaking...  I wonder why the Python documentation, in particular
the official Python tutorial, is not more forthcoming with these


More information about the Python-list mailing list