Proposed new syntax
Chris Angelico
rosuav at gmail.com
Thu Aug 24 03:54:34 EDT 2017
On Thu, Aug 24, 2017 at 5:47 PM, Paul Rubin <no.email at nospam.invalid> wrote:
> Ben Finney <ben+python at benfinney.id.au> writes:
>> generate_id = functools.partial(next, itertools.count())
>
> Is something wrong with:
>
> >>> g = itertools.count().next
> >>> g()
> 0
> >>> g()
> 1
> >>> g()
> 2
> >>> ...
That's the Python 2 version of the same thing. The next method was
renamed to __next__ to synchronize it with other, similar methods.
ChrisA
More information about the Python-list
mailing list