[Baypiggies] puzzle: binding invocation context for a function call during a class declaration

Tim Hatch tim at timhatch.com
Sat Jan 1 19:02:51 CET 2011


>   class Bletch (Expression):
> 
>     expresses(Foo)
>     counter = 3

It took me a second to remember where I'd seen that syntax before.  It's
how Trac handles its component registry -- for example
http://trac.edgewall.org/browser/trunk/trac/attachment.py?marks=352-357#L348

The code behind it is at
http://trac.edgewall.org/browser/trunk/trac/core.py?marks=86-169#L84 and
appears to be using stack introspection as well.

Tim


More information about the Baypiggies mailing list