27.11.17 23:24, Guido van Rossum пише:
Is this problem really important enough that it requires dedicated syntax? Isn't the itertools-based solution good enough? (Or failing that, couldn't we add something to itertools to make it more readable rather than going straight to new syntax?)

I want to remind PEP 204 and PEP 212. The special purposed syntaxes were proposed to help solving much more common problems. They were rejected in favor of builtins range() and enumerate(). And we are happy with these builtins.

The function for solving this problem already exists. It's itertools.islice(). It isn't builtin, but this problem is much less common than use cases for range() and enumerate().

If we don't have special non-function syntax for range(), enumerate(), zip(), itertools.chain(), itertools.count(), itertools.repeat(), etc, I don't think we should have a special syntax for one particular case of using itertools.islice().

_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to