Ipython 0.13.1 can print the source of an object from python library,
such as, os.path.abspath??
But I can’t print the source code of any object I defined through %ed magic in ipython,
Is anything wrong I did?
such as, I define a class Name through %ed magic:
%ed
then
class Name(object):
"""docstring for Name"""
name = 'hong'
def __init__(self, arg):
super(Name, self).__init__()
self.arg = arg
def pri():
print 'class Name'
when back to ipython, I can’t see the source code of class Name:
In [59]: Name??
Type: type
String Form:<class '__main__.Name'>
Docstring: docstring for Name
Constructor information:
Definition:Name(self, arg)
Is this the bug of IPython?
–Edits after OP mentioned this is seen in ipython iteself.
Is there any error message you get after typying %ed myfunc? Pasting that might help others find the issue.
—update:
I also get a short version of the source code when I try Name??, but Name.pri?? gives me the full source code of the pri() member function of the Name class. So ipython may have some convention to not give full source code of classes.
Here is my interaction: