Appending to []
Bernd Nawothnig
Bernd.Nawothnig at t-online.de
Sat Apr 21 08:48:44 EDT 2012
On 2012-04-20, Rotwang wrote:
> since a method doesn't assign the value it returns to the instance on
> which it is called; what it does to the instance and what it returns are
> two completely different things.
Returning a None-value is pretty useless. Why not returning self, which would be
the resulting list in this case? Returning self would make the
language a little bit more functional, without any drawback.
Then nested calls like
a = [].append('x').append('y').append('z')
would be possible with a containing the resulting list
['x', 'y', 'z'].
That is the way I expect any append to behave.
Bernd
--
"Die Antisemiten vergeben es den Juden nicht, dass die Juden Geist
haben - und Geld." [Friedrich Nietzsche]
More information about the Python-list
mailing list