A java hobbyist programmer learning python

Chris Rebert clp2 at rebertia.com
Sun Jan 18 03:01:10 CET 2009


On Sat, Jan 17, 2009 at 5:53 PM, Paul Rubin
<"http://phr.cx"@nospam.invalid> wrote:
> Chris Rebert <clp2 at rebertia.com> writes:
>> Rather than have a long if-elif-else chain like this, you can use a
>> dictionary with functions as values. For example:
>>
>> def add(x, y):
>>     return x + y
>
> These functions are already defined in the operator module, and you
> can also define them inline with the lambda operator.

Did you completely skip over the last sentence of my email? I
specifically mentioned the `operator` module.

Cheers,
Chris

-- 
Follow the path of the Iguana...
http://rebertia.com



More information about the Python-list mailing list