On 2009 Sep 5, at 12:22 PM, Mark Tolonen wrote:
As a list comp:
L=range(30,41)
[{38:34,40:39}.get(n,n) for n in L]
[30, 31, 32, 33, 34, 35, 36, 37, 34, 39, 39]
True, that is terse, but IMHO has maintainability issues. The mapping
data structure and the method of transformation (.get()) are tangled
in with the transformation itself.
Again, IMHO, unless this is a very short script, the maintenance
should outweigh raw terseness.
-Doug
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor