[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: '__iter', yet again!
- From: steve donovan <steve.j.donovan@...>
- Date: Wed, 16 Dec 2009 15:34:56 +0200
On Wed, Dec 16, 2009 at 2:27 PM, John Hind <firstname.lastname@example.org> wrote:
> So we are back were we started (or have I missed something?) – what is
> needed is a new metamethod which is invoked when the explist of a generic
> for fails to resolve a function in its first slot. The object designer could
> put an iterator factory function in this slot which can return any form of
> iterator including stateless.
Not the first time either ;) Mostly we end up with an explicit iter() method.
It is reasonable enough to expect something like __iter to be used by
for, although the detailed semantics could be tricky. Should __iter
take precedence over __call?
I totally agree that using __call in this case is abuse of the concept