[Python-Dev] Re: Single- vs. Multi-pass iterability

Ka-Ping Yee ping@zesty.ca
Thu, 18 Jul 2002 12:31:45 -0700 (PDT)


On Thu, 18 Jul 2002, Clark C . Evans wrote:
> On Wed, Jul 17, 2002 at 02:58:55PM -0500, Ka-Ping Yee wrote:
> | But i think this is more than a minor problem.  This is a
> | namespace collision problem, and that's significant.  Naming
> | the method "next" means that any object with a "next" method
> | cannot be adapted to support the iterator protocol.  Unfortunately
> | "next" is a pretty common word and it's quite possible that such
> | a method name is already in use.
>
> Ping,
>
> Do you have any suggestions for re-wording the Iterator questionare
> at http://yaml.org/wk/survey?id=pyiter to reflect this paragraph above?

I might add something like:

    One motivation for this change is that the name "next()" might
    collide with the name of an existing "next()" method.  This could
    cause a problem if someone wants to implement the iterator protocol
    for an object that already happens to have a method called "next()".
    So far no one has reported encountering this situation.  It seems
    plausible that there will be some objects where it would be nice to
    support the iterator protocol, and we have heard of some objects
    with methods named "next()", but we don't know how likely or
    unlikely it is that there's an object where both are true.

Does that seem fair?


-- ?!ng