[IPython-dev] Cython method printers
Tue Oct 23 14:55:02 CDT 2012
We're running into a printing difference with Cython methods in the new
IPython. I think the problem boils down to: methods of Cython objects
are classed as "built in functions", even though their repr reveals more
information. So for Cython methods,
applied, rather than this line:
Here is an example from numpy illustrating this:
In : import numpy as np
In : a=np.random.mtrand.RandomState()
In : a.seed
Out: <function seed>
In : repr(a.seed)
Out: '<built-in method seed of mtrand.RandomState object at 0x1004d93c0>'
In : print a.seed
<built-in method seed of mtrand.RandomState object at 0x1004d93c0>
In : a.seed.__class__.__module__
Notice that str() and repr() of the Cython method gave much more useful
information than the default built-in function printer.
How do we fix this? I guess we could make the built-in function printer
check the repr to see if more information than just <built-in function
name> is available, but that seems a bit hackish.
More information about the IPython-dev