On 11/22/2010 04:37 PM, Antoine Pitrou wrote:
+1.  The problem with int constants is that the int gets printed, not
the name, when you dump them for debugging purposes :)

Well, it's trivial to subclass int to something with a nicer __repr__. PyGTK uses that technique for wrapping C enums:

>>> gtk.PREVIEW_GRAYSCALE
<enum GTK_PREVIEW_GRAYSCALE of type GtkPreviewType>
>>> isinstance(gtk.PREVIEW_GRAYSCALE, int)
True
>>> gtk.PREVIEW_GRAYSCALE + 0
1
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to