On Tue, Jun 27, 2017 at 11:01:32AM +0200, Stephan Houben wrote: > Hi all, > > Is "itertools.chain" actually that common? > Sufficiently common to warrant its own syntax?
I think it's much more common than (say) sequence repetition: a = [None]*5 which has had an operator for a long, long time. > In my experience, "enumerate" is far more common > among the iterable operations. > And that doesn't have special syntax either. True. But enumerate is a built-in, and nearly always used in a single context: for i, x in enumerate(sequence): ... A stranger to Python could almost be forgiven for thinking that enumerate is part of the for-loop syntax. In contrast, chaining (while not as common as, say, numeric addition) happens in variable contexts: in expressions, as arguments to function calls, etc. It is absloutely true that this proposal brings nothing new to the language that cannot already be done. It's syntactic sugar. So I guess the value of it depends on whether or not you chain iterables enough that you would rather use an operator rather than a function. > A minimal proposal would be to promote "chain" to builtins. Better than nothing, I suppose. -- Steve _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/