alex23 <wuwe...@gmail.com> writes: > On Jan 20, 10:34 pm, "Barak, Ron" <ron.ba...@lsi.com> wrote:
>>>> for num in range(1, 4): > ... string_ = "%d event%s" % (num, (lambda num: num > 1 and "s" or > "")(num)) > ... print string_ The notation here suggests Ron is sligtly confused about what he created. It was equivalent to string_ = "%d event%s" % (num, lambda x: x > 1 and "s" or "") Notice that there's no actual mention of num there, it's a function that takes one parameter. If that parameter happens to be num it does what you want, but there's no way for the interpreter to know what was intended. Tim. -- http://mail.python.org/mailman/listinfo/python-list