Gabriel Rossetti a écrit :
> Bruno Desthuilliers wrote:
>> Gabriel Rossetti a écrit :
(snip)
>>>   registerServiceAtomic = partial(__registerService, True)
>>> registerServiceNonAtomic = partial(__registerService, False)
>>>
>>> I should pass self when applying partial, but then I can't do that 
>>> since self is not available there. Does anyone have any ideas?
>>
>> registerServiceAtomic = partial(__registerService, atomic=True)
>> registerServiceNonAtomic = partial(__registerService, atomic=False)
>>
>> Caveat: you'll have to either invert the order of the atomic and 
>> service params, or call the partials with named arg for service.
>>
>>
> Ok, thanks, I didn't know you could do that, I though partial was always 
> left to right 

It's left to right for positional arguments. Using named arguments, you 
can pass them in whatever order.

> (I had read that about curry)

Which 'curry' ?-)


-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to