On 15 March 2013 17:18, Nathaniel Smith <n...@pobox.com> wrote:

> On 15 Mar 2013 16:50, "Todd" <toddr...@gmail.com> wrote:
> > Within the axes constructor, the constructor would run through each of
> these modules and store them as attributes with the same name as the
> function and the function itself being the contents.  At least if me
> understanding is correct, this would make them behave as methods (since
> they are already set up to take an axes instance as their first argument).
>
> This won't work as described - the function -> unbound method -> bound
> method magic only happens for attributes that aren't found in the object
> dict, when  lookup falls back on the type dict. You'll want to inject the
> functions into the Axes type object, either via a metaclass constructor or
> just by hand after the type is created.
>

You can manually create bound methods using types.MethodType, if necessary.
However, I think adding them to the class is preferable.

Thomas
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

Reply via email to