Martin v. Löwis <mar...@v.loewis.de> added the comment:

> What if use totalsize = object.__sizeof__(struct_obj) ?

That would defeat the purpose of the test. We want to test whether __sizeof__ 
is correct, so we shouldn't use __sizeof__ in the test to compute the expected 
result. I understand that object.__sizeof__ is actually a different 
implementation, but still: there might be errors e.g. in the type definition 
that cancel out errors in the sizeof implementation. The more "directly" the 
expected result is computed, the better.

I also realize that such tests will be fragile if the the structures change. 
This is a good thing, IMO: anybody changing the layout of some object should 
*have* to verify that the size computation is still correct, so it's good that 
the test breaks if the structures change.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue15402>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to