list("".join([("a","b"*2)[x] for x in [1,0,0,1]])
50 characters. Do I win £5?
list("".join([("a","bb")[x] for x in [1,0,0,1]])
Or 49 :o)
Well, you have a missing ")" character, but that would be the
49th. You can[*] abuse python's parsing by removing certain
spaces with
list(''.join([('a','bb')[x]for x in[1,0,0,1]]))
bringing you down to 47. In more recent versions of Python, you
can then pass a generator instead of a list-comprehension:
list(''.join(('a','bb')[x]for x in[1,0,0,1]))
bringing you to 45.
-tkc
[*] not *should*, but *can*
--
http://mail.python.org/mailman/listinfo/python-list