On 2003-04-02, Alif Wahid <[EMAIL PROTECTED]> wrote: > [...] You see in Pango some functions are passed a NULL pointer > to specify default behaviour. This doesn't seem to be the case in > the Python binding, in other words we can't pass a None type object > to achieve the same feat without generating unnecessary exceptions > about the wrong type. In particular the method get_metrics(...) of > a pango.Font derivative doesn't accept the None object and spews > up a TypeError exception instead. On the other hand in the C API > passing a NULL pointer to the same function simply means to do > the default thing (that is to load metrics for the entire font, > not language dependent). So as you can see Python binding should > follow the same sort of Pango API conventions. [...]
Maybe this case should be handled with something similar to the following recipe? http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/68205 It createas a Null class which avoids rasing TypeError and such (or so the recipe claims). The idea would be to differentiate None, which could be passed in from a previous function if something went wrong, and this should still be treated like a mistake. Null instead is like saying "see, I wan't you to use NULL in the C code, and I'm showing that I didn't pass you None by accident". -- Please don't send me private copies of your public answers. Thanks. _______________________________________________ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
