On 8/16/2011 8:18 PM, Philip Semanchuk wrote:

Hi Terry,
To generalize from your example, are you saying that there's a mild admonition
> against shadowing builtins with unrelated variable names in standard lib code?

I would expect that there might be. I would have to check PEP8.

Here's an example from Python 3.2.1's argparse.py, lines 466-473.
> "open" is shadowed on the second line.

         # clean up separators for mutually exclusive groups
         open = r'[\[(]'
         close = r'[\])]'
         text = _re.sub(r'(%s) ' % open, r'\1', text)
         text = _re.sub(r' (%s)' % close, r'\1', text)
         text = _re.sub(r'%s *%s' % (open, close), r'', text)
         text = _re.sub(r'\(([^|]*)\)', r'\1', text)
         text = text.strip()

--
Terry Jan Reedy

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to