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

Steven Bethard steven.bethard at gmail.com
Mon Jan 24 02:31:17 EST 2005


Bengt Richter wrote:
> So, e.g., for
> 
>  >>> presets = dict(a=1, b=2, deftime=__import__('time').ctime())
> 
> in the decorator args, the next version will act as if the decorated
> function had the source code
> 
>  >>> print '%s = __frompresets__' % ', '.join(sorted(presets))
>  a, b, deftime = __frompresets__
> 
> for the current version, except that it will be hidden.

Cool!  Keep us posted.  I assume you'll put this into the Cookbook?

Steve



More information about the Python-list mailing list