Why no warnings when re-assigning builtin names?
Philip Semanchuk
philip at semanchuk.com
Tue Aug 16 22:51:01 EDT 2011
On Aug 16, 2011, at 10:15 PM, Terry Reedy wrote:
> 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.
I was curious, so I checked. I didn't see anything specifically referring to builtins. This is as close as it gets:
"If a function argument's name clashes with a reserved keyword, it is generally better to append a single trailing underscore rather than use an abbreviation or spelling corruption. Thus "print_" is better than "prnt". (Perhaps better is to avoid such clashes by using a synonym.)"
bye
Philip
More information about the Python-list
mailing list