specifying constants for a function (WAS: generator expressions: performance anomaly?)

Steven Bethard steven.bethard at gmail.com
Tue Jan 25 13:58:30 EST 2005


Bengt Richter wrote:
> On Mon, 24 Jan 2005 20:35:09 GMT, bokr at oz.net (Bengt Richter) wrote:
> 
>>>>>from presets import presets, curry
>>>>>@presets(verbose=True, a=1, b=2, deftime=__import__('time').ctime())
>>
>>... def foo():
>>...    print (a, b)
>>...    print deftime
>>...
>>
>>presets: -- "name(?)" means name may be unused
>>           a = 1
>>           b = 2
>>     deftime = 'Mon Jan 24 12:16:07 2005'
>>
>>
>>>>>foo()
>>
>>(1, 2)
>>Mon Jan 24 12:16:07 2005
> 
> Not much reaction

Sorry, it's definitely cool -- I was just waiting for you to post the 
Cookbook link so I could see how you did it. ;)

Steve



More information about the Python-list mailing list