How to guard against bugs like this one?
kj
no.email at please.post
Tue Feb 2 21:35:55 EST 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
below.)
> 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 numbers.py
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
rules.
~K
More information about the Python-list
mailing list