[IPython-dev] Towards IPython 1.0, the famous big cleanup
Fernando Perez
Fernando.Perez at colorado.edu
Fri Apr 15 15:08:14 EDT 2005
Jack Moffitt wrote:
>>>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 :)
I'll keep it in mind, thanks for the feedback. If it's possible to make it
decorator-friendly, I'll definitely do so. I'll have to see in practice if it
all works out, but in principle I don't see why not (I just worry about
mucking with the running instance, but I haven't really thought about it).
And I agree, decorators are also growing on me. It's just that I want to
avoid _requiring_ them for ipython.
Best,
f
More information about the IPython-dev
mailing list