On May 11, 11:41 pm, Ben Finney <[EMAIL PROTECTED]>
wrote:
> Carl Banks <[EMAIL PROTECTED]> writes:
> > On May 11, 6:44 pm, Ben Finney <[EMAIL PROTECTED]>
> > wrote:
> > > In such cases, the name 'dummy' is conventionally bound to the items
> > > from the iterator, for clarity of purpose::
>
> > > for dummy in range(10):
> > > # do stuff that makes no reference to 'dummy'
>
> > Is this documented?
>
> It's not a documented standard, to my knowledge.
>
> > I've never heard of this convention. It's not PEP 8, and I've never
> > seen consistent usage of any name. I'd be interested in knowing
> > where you read that this was a convention, or in what subcommunities
> > it's a convention in.
>
> It has been in this forum that the use of the name '_' for "don't care
> about the value" was deprecated, since that name is already overloaded
> with other meanings.
That doesn't follow at all from what you wrote: no one in this thread
had even mentioned the usage of "_" for unused values--how did you
expect us to know you were talking about something no one brought up?
So it seems that usage of "dummy" is not a convention, and avoidance
of "_" is not really a convention except on this group.
> > I think dummy is a terrible name to use for this, since in no other
> > usage I can think of does the word "dummy" suggest something isn't
> > used.
>
> I think it's far superior to '_'. I'd be just as happy with any other
> name that explicitly distinguishes itself for this purpose.
>
> > If a value isn't used, then I think the most clear name for it is
> > "unused".
>
> Sounds good to me. Now we merely need to convince the world.
I'm happy to discourage the world from using "_" for this purpose;
ambivalent whether you even need to use a specific name.
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list