Lawrence D’Oliveiro <lawrenced...@gmail.com> writes:

> Some of the classes in Qahirah, my Cairo binding 
> <https://github.com/ldo/qahirah> I found handy to reuse elsewhere, for 
> example in my binding for Pixman <https://github.com/ldo/python_pixman>. 
> Subclassing is easy, but then you need to ensure that operations inherited 
> from the superclass return instances of the right class. This means that 
> superclass methods must never refer directly to the class by name for 
> constructing new objects; they need to obtain the current class by more 
> indirect means.

--> "type(obj)" or "obj.__class__" (there are small differences)
give you the type/class of "obj".

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to