Specific iterator in one line

Andreas Tawn andreas.tawn at ubisoft.com
Tue Jun 30 12:55:21 CEST 2009


> -----Original Message-----
> From: python-list-bounces+andreas.tawn=ubisoft.com at python.org [mailto:python-
> list-bounces+andreas.tawn=ubisoft.com at python.org] On Behalf Of Paul Rubin
> Sent: Tuesday, June 30, 2009 11:27 AM
> To: python-list at python.org
> Subject: Re: Specific iterator in one line
> 
> "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]))
> --

Indeed. Stupid paste ;o)



More information about the Python-list mailing list