Category Archives: Snippet

Mandelbrot Set

I’ve finally posted the Mandelbrot Set code snippet that was sitting on my disk for a while. It computes and draws the Mandelbrot Set fractal using pygame, and also Python for Series 60. Three different screenshots are provided. They show … Continue reading

Posted in Fractal, Python, Snippet | Leave a comment

Labyrinth Solver

What about a labyrinth solver function in 16 lines of Python?

Posted in Python, Snippet | 4 Comments

Textual watermarks with Python Imaging Library

I’ve added a new snippet about doing watermarks with PIL.

Posted in Python, Snippet | 2 Comments

Decorator for automatic inclusion of function definition in __doc__

Python 2.4 included support for function decorators. Decorators are callable objects that may modify a given function or class method arbitrarily when they’re prepended with specific syntax to the function/method definition. The following code implements a decorator that will automatically … Continue reading

Posted in Python, Snippet | Leave a comment

All combinations of N elements

Here’s a snippet to compute all combinations of N elements over K positions.

Posted in Math, Python, Snippet | 3 Comments

Permutations of all subsets

Another snippet to compute the permutations of all subsets.

Posted in Math, Python, Snippet | 3 Comments

Permutations and derangements

Two snippets to compute permuatations and derangements in Python.

Posted in Math, Python, Snippet | 4 Comments

Progress Cell Renderer for pygtk

Here is a Progress Cell Renderer for pygtk based applications. It allows one to embed a progress bar inside a TreeView. It’s being used in Smart to present progress for downloads of packages and other items.

Posted in Python, Snippet | Leave a comment

Using pyperl to build a python-like xchat interface for perl

My weekend was taken by boring academic stuff. More specifically, I’ve built a validator in C, including a tokenizer, a parser, and a scope system, to check for a small subset of the C language syntax. Anyway.. I was still … Continue reading

Posted in Perl, Python, Snippet | 1 Comment

Webmin and Perl inside Python

Today I’ve been talking to Cavassin about Webmin, and wondering if it would be possible to write Python modules for it. I was sure that I wasn’t being original in that idea, and Cavassin also mentioned that he had read … Continue reading

Posted in Perl, Python, Snippet | Leave a comment