interface boilerplate
Alex Martelli
aleaxit at yahoo.com
Mon Oct 18 07:17:43 EDT 2004
John Hunter <jdhunter at ace.bsd.uchicago.edu> wrote:
...
> The only problem I've seen so far is that the name of the function in
> pydoc string is 'wrapper', and I want it to appear as "plot". I tried
> setting the __name__ attribute, but it is read only.
Yes, a 2.3 problem, solved in 2.4.
> Any suggestions on how to best define these matlab interface functions
> by automatically wrapping the Axes instance functions? I'd like to
> support python2.2 so python2.2 compliant solutions especially welcome.
Then I guess upgrading to 2.4 is out of the question.
To make a function just like another but with a different name:
def changed_name_function(f, newname):
import new
return new.function(f.func_code, f.func_globals, newname,
f.func_defaults, f.func_closure)
I believe this should work in 2.2 as well (not tested).
Alex
More information about the Python-list
mailing list