[Python-Dev] make iter() return an empty iterator?
Ron Adam
rrr at ronadam.com
Fri Aug 3 12:11:25 CEST 2007
Georg Brandl wrote:
> Sure, you could use ``iter(())`` or ``iter([])``, but for consistency's sake
> wouldn't it make sense for ``iter()`` to return an empty iterator, as ``str()``
> returns an empty string etc.?
>
> Georg
There is a difference.
>>> type(iter)
<type 'builtin_function_or_method'>
>>> type(str)
<type 'type'>
>>> type(int)
<type 'type'>
>>> type(list)
<type 'type'>
Cheers,
Ron
More information about the Python-Dev
mailing list