There's nothing to be done in Cython here. As you point out, a.seed is a builtin (i.e. compiled) method and type(a.seed) returns `builtin_function_or_method` correctly.
This behavior is consistent with builtin Python objects.
In : f = open('links.txt', 'r')
In : f.read
Out: <function read>
In : type(f.read)
In : print f.read
<built-in method read of file object at 0x25830c0>
Can you file a bug report with IPython?
On Friday, October 26, 2012 8:50:47 AM UTC-7, John Palmieri wrote:
This is essentially quoted from a post to the IPython mailing list: http://mail.scipy.org/pipermail/ipython-dev/2012-October/010503.html.
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,
gets applied, rather than this line:
Here is an example from numpy illustrating this, and there are also examples in Sage (like 4.gcd -- see http://trac.sagemath.org/sage_trac/ticket/12719):
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 : type(a.seed)
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? We could patch IPython, but maybe a better solution would be to change Cython so that its methods are not built in functions. Suggestions?