help with writing extension

Alex Martelli aleax at aleax.it
Tue Oct 1 03:44:54 EDT 2002


Eric Hagemann wrote:

> Alex
>     Thanks for another excellent answer.  I am going to dig into the
> Py_TPFLAGS_CHECKTYPES flag as that might just fix my problem.  I did not
> really want to use the __coerce__function but I did not know how to get
> around it. If adding this flag to the definition will skip the __coerce__
> function, that should save me a bunch-o-code.  BTW I see references to the
> CHECKTYPES flag in the Python 2.1 source (Yes - I am still using 2.1) any
> reason why I need to move to 2.2 ?

I find it much more comfortable to define extension types in 2.2 than
it used to be in 2.1, and in particular the ability to subclass and
the greater regularity in introspection between classes and types are
a boon.  I don't have a 2.1 around to check any more, but I'm quite
sure that an extension type which supplies (e.g.) an add method will
NOT appear (e.g. by dir) to have __add__ and __radd__ specials in
2.1 -- PyType_Ready's magic to enable all of this is 2.2 stuff.

To put it another way, I don't think there's any reason to stay with
2.1 at this point.  Apparently even RedHat has FINALLY upgraded (to
2.2.1, from 1.5.2 which they kept using for ages)...


Alex





More information about the Python-list mailing list