"number-in-base" ``oneliner''

exarkun at divmod.com exarkun at divmod.com
Mon Nov 1 16:09:26 EST 2004


On Mon, 01 Nov 2004 20:34:30 GMT, bokr at oz.net (Bengt Richter) wrote:
> [snip]
> 
> BTW, did you try the above?
> >From a post (with broken subject line ;-) of Steven Bethard's, it seems to work.
> I'll re-quote it here to give it context:
> ----
> >Bengt Richter <bokr <at> oz.net> writes:
> >> 
> >> Well, I don't have 2.4 yet, but what does it do?
> 
> >>>> [x for x in [0] for x in iter(lambda:x+1, 4)]
> >[1, 2, 3]
> >>>> list(x for x in [0] for x in iter(lambda:x+1, 4))
> >[1, 2, 3]
> 
> >Looks like it does just what you'd hope it would do.  =)
> 
> >Steve
> ----
> 

  I didn't try it, but that looks like what it should do, and I'll take Steve's word for it that that's what it does indeed do :)

  Jp



More information about the Python-list mailing list