[Python-Dev] How to suppress instance __dict__?
David Abrahams
dave@boost-consulting.com
Sun, 23 Mar 2003 07:58:30 -0500
martin@v.loewis.de (Martin v. L=F6wis) writes:
> David Abrahams <dave@boost-consulting.com> writes:
>
>> Yes, I can define __getstate__, __setstate__, and __getinitargs__ (the
>> only one that can actually do any work, since ints are immutable),
>> but I was wondering if there's a more straightforward way to suppress
>> the instance __dict__ in the derived classes.
>
> Setting tp_dictoffset to 0 might help.=20
AFAICT I don't get to do that, since as I wrote:
I am generating extension types derived from a type which is
derived from int 'int' by calling the metaclass
^^^^^^^^^^^^^^^^^^^^^^^^
> However, I'm unsure what consequences this has; read the source.
Unfortunately, this is one of the twistiest areas of the Python
source, so while I could struggle through it I'm hoping there's
someone around here who knows the answer off the top of his benevolent
Dutch head <wink>
--=20
Dave Abrahams
Boost Consulting
www.boost-consulting.com