On 20/04/2020 16:25, J. Pic wrote:
Hi all,

Currently, list.append(x) mutates the list and returns None.

It would be a little syntactic sugar to return x, for example:

     something = mylist.append(Something())

What do you think ?

I'm generally opposed to trying to do too many things on one line; the more you pile in, the more chance it will be misunderstood. In this case, why would the average naive user expect that your new Something is what's going to be returned? The usual request is to have (the mutated) `mylist` returned (which we don't do for reasons), and that's what people are going to expect.

--
Rhodri James *-* Kynesim Ltd
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/GUU6CJI6M642HKLVF5Y7ZTBQV5QRCHMR/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to