a blog by Marius Gedminas

Posts tagged Python

Profiling/tracing a single function

Sometimes you want to profile just a single function in your Python program. Here's a module that lets you do just that: profilehooks.py. Sample usage: #!/usr/bin/python from profilehooks import profile class SampleClass: def silly_fibonacci_example(self, n): """Return the n-th Fibonacci number. This is a method rather rather than a function just to illustrate that you can use the 'profile' decorator on methods as well as global functions. Needless to say, this is a contrived example.

PyPy sprint in Vilnius

I spent the last week participating in a PyPy sprint. It was fun. I've learned a lot of obscure Python tricks that I'll try to avoid in the future if I do not want my code to be obscure. I had the chance to see how graphviz and Pygame can be combined into a very easy and pleasant to use debugging tool for looking at intricate data structures. Best of all -- I met a number of fine Python programmers: Armin Rigo, Holger Krekel, Michael Hudson, Bob Ippolito, Christian Tismer, Laura Creighton, Jacob Hallen.