I think the "upper" layer of pygtk should be more convenient about
types used in Python. Specifically, it should try not to imitate "C",
where you have to spell everything out, but take advantage of a
language where you can actually check the type of your arguments.
Let me illustrate this by several examples.
For example, when a function expects a color, it throws an error
unless it receives a <GdkColor> type. Wouldn't it be nice if you
could pass it a string, and then for PyGtk to allocate the color for
you, and pass that to the raw function?
Another example: in "C", the TIP_PRIVATE argument to
gtk_tooltip_set_tips() can be passed as NULL, which means you don't
want any special queries or stuff assigned to the tooltip. Now,
wouldn't it be nice if PyGtk allowed me to pass None, and replace it
with NULL at the C level?
The example that really bugs me is pickiness with lists and tuples.
For example, the second argument to drag_dest_set() should be a list
of tuples. However, if I try to pass it a tuple of tuples (which is
only logical, because I never want to modify it), I get an error.
This works:
# Pass a one-element list
dnd_victim.drag_dest_set (DEST_DEFAULT_ALL, [("STRING", 0, 0)],
ACTION_COPY | ACTION_MOVE)
And this doesn't:
# Pass a singleton
dnd_victim.drag_dest_set (DEST_DEFAULT_ALL, (("STRING", 0, 0),),
ACTION_COPY | ACTION_MOVE)
This is a small thing, but it's kind of weird -- Python almost always
allow you to interchange lists and tuples, whenever interchanging them
makes sense.
I'm willing to write more about this and give more examples, as well
as contribute code, if others agree that these changes would be an
improvement.
To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]