Message166511
| Author |
loewis |
| Recipients |
asvetlov, gregory.p.smith, jcea, loewis, mark.dickinson, meador.inge, serhiy.storchaka, skrah |
| Date |
2012年07月26日.20:03:48 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<5011A2A3.60202@v.loewis.de> |
| In-reply-to |
<201207262246.35253.storchaka@gmail.com> |
| Content |
> I do not think that the purpose of testing is a testing of object.__sizeof__.
> Memory consumption consists of two parts -- memory for C structure (and the
> base object implementation works for this)
Note that object.__sizeof__ does something slightly different, though:
it uses basicsize (which may or may not contain the sizeof() invocation
of the correct C structure), and it considers tp_itemsize (which may or
may not have a correct value).
>
>> 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.
>
> Such tests is too fragile. They force the programmer to write unnecessary code
> in cases when it can be done automatically.
That's not the definition of "fragile", though. What you describe is
that writing the test this way is "tedious" (утомительный); it isn't
(necessarily) "fragile" (хрупкий). I (clearly) disagree that this
approach is "too tedious". |
|