prep my types for 2.2?

Pete Shinners pete at shinners.org
Sat Nov 24 02:07:21 CET 2001


i've got several extension types that i'd like to get prepared for 
python-2.2. currently i have a function that constructs the object and a 
"type" variable available..

Myobject()
type(Myobject()) is MyobjectType

from what i can see in python-2.2, these become the same thing. instead 
of a function to construct my objects, i just make it so you can call 
the type directly. i've been browsing over the 2.2 sourcecode recently 
(looking at the int object). i've got a couple questions..

first, i can't figure out exactly what function slots and TP flags i 
need to use to enable this behavior? did i overlook this in the docs 
somewhere? (couldn't find)

the other question, what is the best way to make this work for both 
python-2.2 and earlier releases? it looks like if i hook something nice 
for 2.2 up in the Type structure, that won't work for python-2.1. so it 
2.1 i'll need to fallback to the classes function/type like i already 
have? can i make it so python-2.1 can construct objects from the Type?






More information about the Python-list mailing list