On Jun 30, 2017 2:23 PM, "Erik Bray" <[email protected]> wrote:

I actually really like this proposal, in additional to the original
proposal of using '+' to chain generators--I don't think it
necessarily needs to be extended to *all* iterables.  But this
proposal goes one better.  I just have to wonder what kind of strange
unexpected bugs would result.  For example now you could add a list to
a string:

    >>> list(['a', 'b', 'c'] + 'def')
    ['a', 'b', 'c', 'd', 'e', 'f']

Personally, I really like this and find it natural.  But it will break
anything expecting this to be a TypeError.


Note that you can already do:

[*iterable1, *iterable2]

Or like in your example:

>>> [*['a', 'b', 'c'], *'def']
['a', 'b', 'c', 'd', 'e', 'f']

At least I think you can do that in 3.6 ;)

-- Koos (mobile)
_______________________________________________
Python-ideas mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to