[IPython-dev] Towards IPython 1.0, the famous big cleanup

Jack Moffitt jack at xiph.org
Fri Apr 15 13:50:27 CDT 2005


> >Not that I like the new decorator syntax, but something like:
> >
> >@InteractiveShell.magicmethod
> >def run_batch(...)
> >   ...
> >
> >Is pretty easy to read and grok.
> 
> Yup, but that's 2.4.  I'm trying to hold on to 2.2 compatibility for as 
> long as I can.  That may be too much to ask, but definitely 2.3 will be a 
> target, so 2.4-specific features may be out.

You can easily do both (I think).  Just make your new_magic_method(x) do:

x = InteractiveShell.magicmethod(x)

Then people adding new magic (if they are using 2.4) can use the easier
decorator syntax, and the rest of the world can do it however they want
:)

Anyway, I've been reading various cool tricks people are doing with
decorators, so I had it on the brain :)

jack.




More information about the IPython-dev mailing list