[IPython-User] Heads up - major changes landed

David Hirschfeld dave.hirschfeld@gmail....
Tue Apr 16 03:19:37 CDT 2013


Thomas Kluyver <takowl <at> gmail.com> writes:

>
>
> We've just landed PR #2447, which is a major reworking of our input transformation framework (the bit that allows IPython goodies like magic commands, cell magics, system commands, autocalling, and so on).The test suite is parsing, but with any major change, there's a risk of breaking things in corner cases, so if you see anything unexpected, please make sure we know about it. And if you're giving a vital demo, you might not want to 'git pull' just before you're on.
> Thanks,Thomas
>

I've just updated to the latest IPython and am seeing some strange
behaviour with the cythonmagic - it seems to choke on non-python
syntax but only in certain circumstances:

In [1]: %load_ext cythonmagic

In [2]: %%cython
   ...:
   ...: cimport cython
   ...: def f(x):
   ...:     return 2.0*x
  File "<ipython-input-2-16e622cf1638>", line 2
    cimport cython
                 ^
SyntaxError: invalid syntax


In [3]: %%cython
   ...: cimport cython
   ...: def f(x):
   ...:     return 2.0*x
   ...:

In [4]: f(2.0)
Out[4]: 4.0


In [5]: %%cython
    ...: cimport cython
    ...:
    ...: def f(double x):
    ...:     return 2.0*x
  File "<ipython-input-11-124eaf389bed>", line 2
    def f(double x):
                 ^
SyntaxError: invalid syntax


Anyone else seeing this?

A good test-case (that fails for me) could be the cythonmagic notebook:

http://nbviewer.ipython.org/urls/raw.github.com/ipython/ipython/3607712653c66d63e0d7f13f073bde8c0f209ba8/docs/examples/notebooks/cython_extension.ipynb

Thanks,
Dave


More information about the IPython-User mailing list