Specific iterator in one line

Paul Rubin http
Tue Jun 30 12:26:39 CEST 2009


"Andreas Tawn" <andreas.tawn at ubisoft.com> writes:
> list("".join([("a","b"*2)[x] for x in [1,0,0,1]])
> 50 characters. Do I win £5?

Er, missing right paren.  Try:

list("".join(("a","bb")[x] for x in [1,0,0,1]))



More information about the Python-list mailing list