Proposed new syntax

Peter Otten __peter__ at web.de
Thu Aug 24 04:05:05 EDT 2017


Paul Rubin 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

That question seems to be the topic of this subthread.

Other than the principle "never call a dunder method" (that I do not follow 
strictly) you accidentally bring up another argument: compatibility between 
Python 2 and Python 3 where the next() method has been renamed to 
__next__().




More information about the Python-list mailing list