Re: PEP 322: Reverse Iteration (REVISED, please comment)
From: Raymond Hettinger (vze4rx4y_at_verizon.net)
Date: 10/29/03
- Next message: Terry Reedy: "Re: On PEP 322 (ireverse)"
- Previous message: Todd Miller: "gc assertion failure"
- In reply to: Terry Reedy: "Re: PEP 322: Reverse Iteration (REVISED, please comment)"
- Next in thread: Peter Otten: "Re: PEP 322: Reverse Iteration (REVISED, please comment)"
- Reply: Peter Otten: "Re: PEP 322: Reverse Iteration (REVISED, please comment)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 29 Oct 2003 17:51:30 GMT
> Since iter() constructs and returns a type 'iterator' object, I
> expected that it might be a type object, just like int(), etc. If it
> were turned into one, like int(), etc, have been, then
. . .
> Unless there is a good reason to not make iter a type object, then
> making it so could be part of the suggested implementation of the PEP.
iter() is a factory function that can return all kinds of things:
>>> from random import random
>>> iters = iter('str'), iter(['list']), iter(dict(a=1)), iter(random, None)
>>> map(type, iters)
[<type 'iterator'>, <type 'listiterator'>, <type 'dictionary-iterator'>, <type
'callable-iterator'>]
Let's see if we can get back to the merits of the pep.
Looking at your own code, can you verify that ireverse()
is an improvement over what you have now.
Raymond Hettinger
- Next message: Terry Reedy: "Re: On PEP 322 (ireverse)"
- Previous message: Todd Miller: "gc assertion failure"
- In reply to: Terry Reedy: "Re: PEP 322: Reverse Iteration (REVISED, please comment)"
- Next in thread: Peter Otten: "Re: PEP 322: Reverse Iteration (REVISED, please comment)"
- Reply: Peter Otten: "Re: PEP 322: Reverse Iteration (REVISED, please comment)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|