[Python-Dev] Path inherits from string
"Martin v. Löwis"
martin at v.loewis.de
Thu Jan 26 19:54:03 CET 2006
M.-A. Lemburg wrote:
> Please note that inheritance from string will cause the C type
> checks of the form PyString_Check(obj) to return true.
> C code will then assume that it has an object which is
> compatible to string C API which instances aren't.
Oh, sure they are. Types inheriting from str have the same
layout as str, and C code assuming that layout will work fine
with them. Inheritance works (saying "inheritance *just* works
would deny the many fine details that have been engineered to
actually make it work").
Regards,
Martin
More information about the Python-Dev
mailing list