> > (This is no mere Python "wart"; this is a suppurating chancre, and > the fact that it remains unfixed is a neverending source of puzzlement > for me.) > > How can the average Python programmer guard against this sort of > time-devouring bug in the future (while remaining a Python programmer)? > The only solution I can think of is to avoid like the plague the > basenames of all the 200 or so /usr/lib/pythonX.XX/xyz.py{,c} files, > and *pray* that whatever name one chooses for one's script does > not suddenly pop up in the appropriate /usr/lib/pythonX.XX directory > of a future release. >
First, I don't shadow built in modules. Its really not very hard to avoid. Secondly, I use packages structuring my libraries, and avoid junk directories of a hundred some odd 'scripts'. 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. Note that the third avoids the above problem entirely, but that's not why I do it. Its just a side-effect. --S
-- http://mail.python.org/mailman/listinfo/python-list