make iter() return an empty iterator?
2007/8/3, Andrew Bennetts
I don't really think there's much reason to make "iter()" work. As you say,
What bad thing could happen if we make iter() work? If nothing, we should ask ourselves: which is the more intuitive behaviour to expect of iter()? To raise an exception or to return an empty iterator? I'm +0 for the latter. -- . Facundo Blog: http://www.taniquetil.com.ar/plog/ PyAr: http://www.python.org/ar/
On 8/3/07, Facundo Batista
2007/8/3, Andrew Bennetts
: I don't really think there's much reason to make "iter()" work. As you say,
What bad thing could happen if we make iter() work? If nothing, we should ask ourselves: which is the more intuitive behaviour to expect of iter()? To raise an exception or to return an empty iterator?
I'm +0 for the latter.
-1. I'm a heavy user of iterators on finite and infinite streams and, for me, iter() is an error that I do not want to paper over. The alternate logic implies, e.g., len() should return 0. -Kevin
Kevin Jacobs
On 8/3/07, *Facundo Batista*
mailto:facundobatista@gmail.com> wrote: 2007/8/3, Andrew Bennetts
mailto:andrew-pythondev@puzzling.org>: > I don't really think there's much reason to make "iter()" work. As you say,
What bad thing could happen if we make iter() work? If nothing, we should ask ourselves: which is the more intuitive behaviour to expect of iter()? To raise an exception or to return an empty iterator?
I'm +0 for the latter.
-1. I'm a heavy user of iterators on finite and infinite streams and, for me, iter() is an error that I do not want to paper over. The alternate logic implies, e.g ., len() should return 0.
-1 here too. iter() should have an argument just like sum() and len(). regards Steve -- Steve Holden +1 571 484 6266 +1 800 494 3119 Holden Web LLC/Ltd http://www.holdenweb.com Skype: holdenweb http://del.icio.us/steve.holden --------------- Asciimercial ------------------ Get on the web: Blog, lens and tag the Internet Many services currently offer free registration ----------- Thank You for Reading -------------
On 8/3/07, Steve Holden
Kevin Jacobs
wrote: On 8/3/07, *Facundo Batista*
mailto:facundobatista@gmail.com> wrote: 2007/8/3, Andrew Bennetts
mailto:andrew-pythondev@puzzling.org>: > I don't really think there's much reason to make "iter()" work. As you say,
What bad thing could happen if we make iter() work? If nothing, we should ask ourselves: which is the more intuitive behaviour to expect of iter()? To raise an exception or to return an empty iterator?
I'm +0 for the latter.
-1. I'm a heavy user of iterators on finite and infinite streams and, for me, iter() is an error that I do not want to paper over. The alternate logic implies, e.g ., len() should return 0.
-1 here too. iter() should have an argument just like sum() and len().
Amen. -- --Guido van Rossum (home page: http://www.python.org/~guido/)
participants (4)
-
Facundo Batista
-
Guido van Rossum
-
Kevin Jacobs <jacobs@bioinformed.com>
-
Steve Holden