"Don't rebind built-in names*" - it confuses readers
Steven D'Aprano
steve+comp.lang.python at pearwood.info
Tue Jun 11 12:59:46 EDT 2013
On Tue, 11 Jun 2013 08:22:19 -0700, Rick Johnson wrote:
> On Monday, June 10, 2013 9:56:43 PM UTC-5, Steven D'Aprano wrote:
>> On Mon, 10 Jun 2013 20:14:55 -0400, Terry Jan Reedy wrote:
>> > Reading further, one sees that the function works with two lists, a
>> > list of file names, unfortunately called 'list', and a list of
>> > subdirectories, more sensibly call 'subdirs'.
>>
>> Yes, that is a poor choice of names. But sometimes you are dealing with
>> a generic list, and calling it "filenames" would be equally
>> inappropriate :-)
>
> I agree, however hopefully you're joking, because in the past you've
> argued that programmers should never use variables as generic as "list",
> "string", "integer", "float", etc... even though there are instances
> when all you need to know is what type your working with.
Do you have a reference for me saying that one should NEVER use generic
names? That doesn't sound like something I would say. Sometimes you're
writing a generic function that operates on a generic variable in a
generic fashion, so of course you should use a generic name.
> One of the most important side-effects of using an editor with
> colorizing capabilities is to show you that you're using a built-in or
> keyword as a variable!
I wouldn't exactly call it a "side-effect", since distinguishing tokens
in your source code by category is the whole purpose of colouring source
code in the first place.
> I love when people comment on subjects they have
> no direct experience with, like for instance, you commenting on
> colonizers or GUI's -- LOL!
I must admit I have no experience with colonizers, although of course I
do have a colon of my very own. It works away absorbing water and
nutrients without my active supervision.
--
Steven
More information about the Python-list
mailing list