Appending to []

Bernd Nawothnig Bernd.Nawothnig at t-online.de
Sat Apr 21 13:43:40 EDT 2012


On 2012-04-21, Kiuhnm wrote:
> Sorry if I wasn't clear. I meant that one should either relies on 
> side-effects and write something like
>    a.append('x').append('t').append('z')
> or use a more functional style and write
>    a = a + [x] + [z]
> Mixing the two doesn't seem very elegant to me.
> I also think that if you need to repeatedly modify an object in the same 
> expression, then you should prefer the more functional approach.
> I wasn't suggesting that you didn't know what functional programming and 
> side effects are.
> Mine was a justification (maybe opinable) of why append was designed 
> that way.

Ok, understood and accepted 



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