Naming conventions for iterator methods?

John J. Lee jjl at pobox.com
Tue Dec 23 20:43:38 CET 2003


Jp Calderone <exarkun at intarweb.us> writes:

> On Tue, Dec 23, 2003 at 01:14:19PM +0000, John J Lee wrote:
> > [snip]
> > 
> > I just realised some of these methods of mine don't actually return
> > iterators, but merely objects supporting the iterator protocol.  In other
[...]
> > returns a lazy iterator).  Would that surprise people from a method named
> > .iter_foo()?
> 
>   Yes.  return "iter(something)" instead of just "something".

Good idea, thanks.


John




More information about the Python-list mailing list