[Python-Dev] (no subject) (original) (raw)
Antoine Pitrou solipsis at pitrou.net
Tue Feb 10 09:27:50 CET 2015
- Previous message: [Python-Dev] (no subject)
- Next message: [Python-Dev] (no subject)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Tue, 10 Feb 2015 19:04:03 +1300 Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
Donald Stufft wrote: > > perhaps a better > solution is to simply make it so that something like ``alist + > aniterable`` is valid and the iterable would just be consumed and +’d > onto the list.
I don't think I like the asymmetry that this would introduce into + on lists. Currently [1, 2, 3] + (4, 5, 6) is an error because it's not clear whether the programmer intended the result to be a list or a tuple.
bytearray(b"a") + b"bc" bytearray(b'abc') b"a" + bytearray(b"bc") b'abc'
It's quite convenient. In many contexts lists and tuples are quite interchangeable (for example when unpacking).
Regards
Antoine.
- Previous message: [Python-Dev] (no subject)
- Next message: [Python-Dev] (no subject)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]