On 27.06.2017 21:27, David Mertz wrote:
And I would like a language change that made a number of common
iterable objects "chainable" without the wrapper. This wrapper could
of course be used as a decorator too.
E.g. generator comprehensions, things returned by itertools functions,
range(), enumerate(), zip(), etc. This wouldn't promise that EVERY
iterable or iterator had that "chainable" behavior, but it would cover
90% of the use cases. And I wouldn't find it confusing because the
leftmost object would be the one determining the behavior, which feels
more intuitive and predictable.
I think that most people in favor of this proposal agree with you here.
Let's start with something simple which can be extended bit by bit to
cover more and more use-cases.
I for one would include also right-handed iterators/generator because I
definitely know real-world usage (just recently) but that can wait until
you feel comfortable with it as well.
If it's a language change, I would like the plus operator to be it as it
integrated well with lists, such as
generator + (list1 + list2)
It can be sometimes necessary to group things up like this. Using a
different operator symbol here, I would find confusing. Plus looks like
concat to me.
Regards,
Sven
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/