Better pyplot wrappers

Eric Firing <efiring@...229...> writes:

The current pyplot wrappers all have an argspec of (*args, **kwargs),
which means that any interactive tools that show the possible arguments

It is in some ways a separate change, but it would be nice if the
boilerplate were generated at build time, and/or generated as a separate
file from which pyplot.py would import everything. I don't like having
a single file that is partly hand-edited and partly machine-generated.

You're right, it would be better to generate it at build time. One
problem with this is that my version of boilerplate.py needs to import
axes.py to access the methods of the Axes class, and axes.py in turn
imports other things, making it impossible to run boilerplate.py without
having compiled the compilable modules. That's why I munge sys.path
before importing axes -- and there are lots of things that could go
wrong with that.

I guess a more correct approach would be to use something like the
parser module to read axes.py without executing the code.

Since we only support Python >=2.4 now, we could get rid of the whole
boilerplate code system and replace it with something more dynamic as
envisioned in

http://groups.google.com/group/comp.lang.python/browse_frm/thread/dcd63ec13096a0f6/1b14640f3a4ad3dc?#1b14640f3a4ad3dc

but I don't see any way of keeping the wrapped function's argspec
without doing something much like what we do now.

Have you looked at the decorator module?
decorator · PyPI

That looks like it could work -- the memoize example seems to be pretty
close to our wrapping needs. I'll spend some time thinking about this
later. Thanks for the link!

···

--
Jouni K. Sepp�nen

We use Michele's decorators.py extensively in ipython for writing
testing wrappers, we carry a local copy we call decorators_msim and
then add some utilities on top. Feel free to pillage as needed or
just read for info:

http://bazaar.launchpad.net/~ipython-dev/ipython/0.10/annotate/head%3A/IPython/testing/decorators.py

Cheers,

f

···

On Mon, Jun 8, 2009 at 2:29 AM, Jouni K. Seppänen<jks@...278...> wrote:

Have you looked at the decorator module?
decorator · PyPI

That looks like it could work -- the memoize example seems to be pretty
close to our wrapping needs. I'll spend some time thinking about this
later. Thanks for the link!