How to print lambda result ?

Terry Reedy tjreedy at udel.edu
Tue Jan 20 22:15:55 EST 2009


Tino Wildenhain wrote:
>
> or in python <3.0:
> 
> (num,"s"*(num >1))

works fine in 3.0 too
 >>> num=1
 >>> (num,"s"*(num >1))
(1, '')
 >>> num=2
 >>> (num,"s"*(num >1))
(2, 's')

Of course, 0 events gets 's' also, so (num!=1) is the actual comparison 
needed.




More information about the Python-list mailing list