This is not related to the init.sage file, but to the fact that TriangleNumbers is a class. You can reproduce the problem like this
sage: class TriangleNumbers: ....: pass sage: import inspect sage: inspect.getsourcelines(TriangleNumbers) ... TypeError: <class '__main__.TriangleNumbers'> is a built-in class which is what gets called in `sage.misc.sageinspect`. On the other hand, for functions defined in the init.sage file, inspection works as usual. This is an IPython feature, which is not directly implemented in Sage. There is an IPython issue for the problem with classes: https://github.com/ipython/ipython/issues/11249 -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/96cbc125-b974-43b5-af03-50bf3c6a6410n%40googlegroups.com.