[Python-3000] PEP: rename it.next() to it.next(), add a next() built-in (original) (raw)

Barry Warsaw barry at python.org
Mon Mar 5 19:44:12 CET 2007


-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1

On Mar 5, 2007, at 1:36 PM, Martin v. Löwis wrote:

-1. I dislike the introduction of more builtins unless they have a true generality (i.e. are likely to be needed in many programs). For this one, I think the normal usage of next will be with a for loop, so I don't think one would often need an explicit next() invocation.

I have had occasional need to call .next() explicitly. IIRC the code
in question was handed an iterator but only needed the first object
out of the iterator. It would be really ugly to have to use next () or force a once-through for loop.

OTOH, making iterators callable as equivalent to .next() as I think
Raymond suggested sounds about perfect. You get next(), plus
explicit iteration with no additional built in necessary.

-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (Darwin)

iQCVAwUBRexk/XEjvBPtnXfVAQIq0gP+KULlyQNTAEsrxqQIQYO8e5eP/zbIazsa idKofJaQVEp9QbpIUBWj4RdzfesEkhjhy3dtNo3APGMCej4YsPhuHQMeoucVSKA/ 1FUXwyVUliqa4yrN9pFadXYTd9dZcep++Hbgb76REp2wUejdNkO0k/lnIZ0JERcv 33Wt64r21x4= =ZWgi -----END PGP SIGNATURE-----



More information about the Python-3000 mailing list