Steven Bethard wrote:
I wrote:
 > If you really want locals that don't contribute to arguments, I'd be
 > much happier with something like a decorator, e.g.[1]:
 >
 > @with_consts(i=1, deftime=time.ctime())
 > def foo(x, y=123, *args, **kw):
 >    return x*y, kw.get('which_time')=='now' and time.ctime() or deftime
 >
 > Then you don't have to mix parameter declarations with locals
 > definitions.
 >
 > Steve
 >
 > [1] I have no idea how implementable such a decorator would be.  I'd
 > just like to see function constants declared separate from arguments
 > since they mean such different things.

I played around with this, and I think it's basically implementable:

Raymond's constant binding decorator is probably a good model for how to do it: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/277940

Cheers,
Nick.

--
Nick Coghlan   |   [EMAIL PROTECTED]   |   Brisbane, Australia
---------------------------------------------------------------
            http://boredomandlaziness.skystorm.net
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to