[Python-3000] Iterators for dict keys, values, and items == annoying :)

Michael Walter michael.walter at gmail.com
Fri Mar 24 15:05:54 CET 2006


On 3/24/06, Barry Warsaw <barry at python.org> wrote:
> On Thu, 2006-03-23 at 17:06 -0800, Guido van Rossum wrote:
>
> > The pattern with the 'empty' flag is only needed when due to API
> > constraints you have only got an iterator.
>
> Which can happen quite often actually.  Perhaps making the original
> object available as an attribute of the iterator can help in those
> situations though.

This potentially gives a different result (the iterator could be
partially consumed). If you are interested in all items anyway you can
just pass the iterable object.

Michael

>
> -Barry
>
>
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.2.2 (GNU/Linux)
>
> iQCVAwUARCPvgHEjvBPtnXfVAQIyxgP/ePmQkJpAd+EISjQT02F8eQt/KymgsCwc
> oBlyp6w5HmnUx25QAY54CiivOfNT79lwTBK3vwkc0C0F6KFX7ezpuEPitrEurdy2
> bPYuttB02pENO/9msH87GmYgQg93b03IbMqLiuLBURt6nL0ywecArDKu62kYELD9
> ADZZVNQIvKA=
> =VzfM
> -----END PGP SIGNATURE-----
>
>
> _______________________________________________
> Python-3000 mailing list
> Python-3000 at python.org
> http://mail.python.org/mailman/listinfo/python-3000
> Unsubscribe: http://mail.python.org/mailman/options/python-3000/michael.walter%40gmail.com
>
>
>


More information about the Python-3000 mailing list