[Python-Dev] Re: PEP 279
Guido van Rossum
guido@python.org
Fri, 29 Mar 2002 01:41:05 -0500
> > 1. indexed()
> > I don't like the name "indexed"; adjectives do not make good
> > function names. Maybe iterindexed()?
>
> Any reasonable name is fine with me.
> Originally, I proposed index() but was talked out of it.
>
> I like itercount() or enumerate(). The reason is that this
> function can work with any iterable including those that
> do not have numeric indices (such as dictionaries).
> Counting or enumeration is what is really happening.
I don't like either of those, you don't seem to like iterindexed(), so
we'll have to think more about a name.
> for linenum, line in itercount( alinelist, 1 ):
> print 'Line %03d: %s' % (linenum, line)
You can do that like this:
for linenum, line in itercount(alinelist):
print 'Line %03d: %s' % (linenum+1, line)
> In summary, here is my order of preference:
> 1. itercount(collection, countfrom=0, stop=None) # best
> 2. itercount(collection, countfrom=0) # almost
> excellent
> 3. itercount(collection) # good
> enough
I really hate the alternate count option, so let's agree to pick 3
(with a different name).
> > 2. Generator comprehensions
> If implementation effort were taken out of the equation, would the
> balance shift back to a +1 ? In other words, if I find a developer
> who wants this badly enough to work with me to get it implemented,
> do we have a go?
Not really. After it's written (and debugged!), it's still a lot of
code that needs to be maintained (we're already thinking about
rewriting the bytecode generators, there's Jython, and so on) for a
very slight benefit. What other feature would you give up in order to
have this on?
If the only way to get you to stop asking for this is a -1 from me,
I'll give it a -1.
> Several commenters wanted this one quite a bit. An excerpt: "This
> rules. You rock."
Yeah, if I left Python's design to Ping, it would become quite the
clever hack. :-)
> > 3. Generator exception passing
> I need help from others on py-dev who can articulate the need clearly.
> For me, it's as plain as day and I don't know what to say to convey the
> message better than it is expressed in the PEP.
Too bad. This one gets a big fat -1 until there's a good motivational
section.
--Guido van Rossum (home page: http://www.python.org/~guido/)