Martin v. Löwis <[EMAIL PROTECTED]> added the comment:

> 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.

__________________________________
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue2898>
__________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to