<p>I'm trying to keep dependencies to a minimum for a program I contribute to, it's a small text editor.</p>

<p>GTK Textview doesn't seem to come with a built-in undo function. Is there any reference implementation I've been missing on so far? Is everyone writing their own undo function for their TextView widgets?</p>

<p>I'll be happy about any sample code - most happy about python sample code, as our project is in python.</p>

As far as I know, GTK TextView doesn't include an undo function. So while I am not familiar with Python's GTK library, I would think it doesn't have one.
The Ruby-GNOME2 project has a
sample text editor
that has undo/redo functionality. Basically they are connecting to the insert_text and delete_range signals of the TextView widget and recording the events and associated data in a list.