[Python-Dev] Re: PEP 290 revisited

Terry Reedy tjreedy@udel.edu
Thu, 9 Jan 2003 11:53:58 -0500


"Kevin Altis" <altis@semi-retired.com> wrote in message
news:KJEOLDOPMIDKCMJDCNDPIEGGCLAA.altis@semi-retired.com...

> The downside is that after a certain point, a Python programmer
starts
> looking at the standard libs and common packages for inspiration and
code to
> reuse in their own code, at least I know I did. That's where I
picked up my
> use of the string module, types, == None and != None, etc.

I think the issue of the library setting bad examples should not be
dismissed.  I have seen at least two modules that use 'list' as a list
variable name (ie, with 'list=[]' followed by 'list.append(val)' in a
for loop).  In the meanwhile, experienced Pythoneers are constantly
recommending "Don't do that!", "Bad habit, change your code", etc (and
similarly for str, dict, and other builtins) on c.l.p.

With PythonWin (for instance), it would be fairly easy to grep and
edit the entire library for one potential-bad-usage word at a time.
It would be somewhat tedious, but fairly easy and quite safe if done
with reasonable care.  I would pick a uniform replacement, like
'listx' for 'list', that is unlikely to conflict with other var names.
Of course, each function would have to be scanned to make sure of no
conflict.

Terry J. Reedy