Hi,

Wanting to print the correct plural after numbers, I did the following:

for num in range(1,4):
    string_ = "%d event%s" % (num,lambda num: num > 1 and "s" or "")
    print string_

However, instead of getting the expected output:

1 event
2 events
3 events

I get:

1 event<function <lambda> at 0x00AFE670>
2 event<function <lambda> at 0x00AFE670>
3 event<function <lambda> at 0x00AFE6B0>

Reading the first results of http://www.google.com/search?q=python+lambda 
didn't enlighten me.

Could you point to a URL which could set me on the right path to get the 
expected output ?

Thanks,
Ron.
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to