[Python-Dev] Re: PEP 279 revisited (original) (raw)
Just van Rossum just@letterror.com
Wed, 24 Apr 2002 20:53:06 +0200
- Previous message: [Python-Dev] Re: PEP 279 revisited
- Next message: [Python-Dev] pep 279 rehashed
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Alex Martelli wrote:
Apart from this, "indices" suggests you're getting ONLY indices -- while when you iterate on this type you get indices AND contents.
Neil Schemenauer wrote:
Ah, I misunderstood what this unnamed function does. I was thinking it works like .keys() on dictionaries. You're telling me it works like ..items(). In that case I don't like enumerate() or itemize(). :-(
Eh, this is the definition from the PEP:
def enumerate(collection):
'Generates an indexed series: (0,coll[0]), (1,coll[1]) ...'
i = 0
it = iter(collection)
while 1:
yield (i, it.next())
i += 1
(And enumerate() gets a +1 from me.)
Just
- Previous message: [Python-Dev] Re: PEP 279 revisited
- Next message: [Python-Dev] pep 279 rehashed
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]