Extension type inherit from Python int

Random832 random832 at fastmail.com
Thu Jan 16 17:12:08 EST 2020


On Thu, Jan 16, 2020, at 12:33, Mathias Enzensberger via Python-list wrote:
> Has anyone already done something like that? Is there some trick to 
> work around that issue, or is it simply not possible to inherit from 
> PyLongObject?

pure-python types that derive from int place __dict__ at the end of the object, I don't know if it's possible for you to do the same with the fields you intend to add (for some reason it isn't done with __slots__), but if all else fails you could do the same and store whatever data you need in the dict.


More information about the Python-list mailing list