Comment on PEP-0322: Reverse Iteration Methods

sebastien s.keim at laposte.net
Fri Sep 26 09:35:29 CEST 2003


"Raymond Hettinger" <vze4rx4y at verizon.net> wrote in message news:<wCGcb.3064$yU5.2141 at nwrdny01.gnilink.net>...

> If you have a magic method, __riter__, then the corresponding
> function needs to be a builtin.  They go hand in hand.  The
> core parts of the language need to be usable without having
> to know about itertools.

I don't think so:
We already have this situation for the the copy module:
copy.copy() use the __copy__ magic method and copy.deepcopy() use
__deepcopy__
I've never heard about problems with this behaviour.

In fact it's not the __riter__ magic method which will use riter()
function but the opposite, so an object which define __riter__ doesn't
need to now anything about riter().




More information about the Python-list mailing list