[Tutor] Can a method be added to dictionary?

Luke Paireepinart rabidpoobear at gmail.com
Fri Nov 20 19:03:08 CET 2009


Does the partial just do a lambda in the background? It's a neat
example, thanks! I've never seen this used before. Sorry if reply is
top-posted or otherwise weird, posting from mobile.

On 11/20/09, Lie Ryan <lie.1296 at gmail.com> wrote:
> lauren at protopc.com wrote:
>> John,
>>
>> Thank you so much for your help! -- Problem SOLVED!!! -- Your explanation
>> and example was extremely helpful. I am very grateful.
>>
>> Lauren :-)
>
> if you want to pass an argument, you can "curry" the function with
> functools.partial()
>
> # currying the function, don't execute yet..
> d = {'abc': functools.partial(func, arg1, arg2, arg3),
>      }
>
> # execute the curried function now
> d['abc']()
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>

-- 
Sent from my mobile device


More information about the Tutor mailing list