This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author loewis
Recipients georg.brandl, gvanrossum, loewis, rhettinger, schuppenies
Date 2008-05-19.20:48:09
SpamBayes Score 0.17608088
Marked as misclassified No
Message-id <4831E787.9040300@v.loewis.de>
In-reply-to <1211209780.18.0.531576336933.issue2898@psf.upfronthosting.co.za>
Content
> I'm torn about the extra slot; I'd rather not add one, but I can't see
> how to make this flexible enough without one.

I think adding a default __sizeof__ implementation into object
(__basicsize__ + len()*__itemsize__), plus overriding that in
subclasses, should do the trick.

Not adding the default into object would cause an exception to be
raised whenever sys.sizeof checks for __sizeof__, which is fairly
expensive.

Having to look __sizeof__ up in the class dictionary, and
creating an argument list, is still fairly expensive (given that the
application we have in mind will apply sizeof to all objects,
repeatedly), however, this being a debugging facility, this overhead is
probably ok.
History
Date User Action Args
2008-05-19 20:48:12loewissetspambayes_score: 0.176081 -> 0.17608088
recipients: + loewis, gvanrossum, georg.brandl, rhettinger, schuppenies
2008-05-19 20:48:11loewislinkissue2898 messages
2008-05-19 20:48:10loewiscreate