On Sunday, May 10, 2015 at 7:03:02 AM UTC-5, Edward K. Ream wrote:

The primary task is to associate a decorator with an *instance *of a class. 
> The code that I pushed yesterday does this by defining a cmd decorator for 
> each class that defines a Leo command.
>
> When I awoke this morning I saw that a single dict, say 
> *g.cmd_instance_dict*, could eliminate the need for per-class 
> decorators.  
>

Alas, there appears to be no way for the wrapper to recover the class 
name.  Indeed, the "func" argument to the wrapper is a *function*, not a 
method.  For example, func.__class__ is None.

Following Reinhard's suggestions, it might be possible to use the inspect 
module or the func's code object to recover the enclosing class's name.  
But I wouldn't bet on it.

So it appears that per-class cmd decorators will be required.  It's not the 
end of the world :-)

Edward

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at http://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.

Reply via email to