An alternative to adding/removing/commenting out/uncommenting print statements through your code may be to use decorators. A decorator is a a function that is passed your function whenever it is called. A decorator can do whatever you want. Some of the possibilities are caching values of the function, but a decorator might be used to print debugging statements or keep track of how many times a method is called (or even pause or wait for input). Some IDEs might have step through and breakpoint capability. If my memory serves me correctly, there is a command (I think it works only in the command line, not in the notebook) that will give timing and method invocations for code.
@somedecorator def somefunction(): code When somefunction is called, somedecorator (which is actually another callable function somewhere) gets called. Hope this helps. Kevin Stueve On Nov 15, 9:08 pm, James Youngquist <james.youngqu...@gmail.com> wrote: > Hello, > > I'm new at the whole python/sage thing. Is there a better way to debug > pieces of code we're working on other than to insert print statements? > Something where we can step through the code a line at a time or generate > profiling information regarding number of times a function was called? > > Thank you, > Jim Youngquist --~--~---------~--~----~------------~-------~--~----~ To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---