[Pywikipedia-l] Two minor problems in replace.py (attn xqt)

Bináris wikiposta at gmail.com
Fri Feb 25 18:39:01 UTC 2011


Thanks you both!

2011/2/25 Merlijn van Deen <valhallasw at 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.


-- 
Bináris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wikimedia.org/pipermail/pywikipedia-l/attachments/20110225/c599bf1d/attachment.htm 


More information about the Pywikipedia-l mailing list