2011/2/25 Merlijn van Deen
<valhallasw@arctus.nl>
Of course, the
>>> 'a' if append else 'w'
is nicer, but has only been supported for python 2.5+.
This is my personal favourite, and I really would be glad to see 2.4 in the museum (together with all 2.x :-D)
An alternative, third, method, would be
>>> append = True
>>> ['w', 'a'][append]
'a'
This is great, I would never have thought of that myself! I learned something interesting today.