[Python-Dev] 2.4 vs Windows vs bsddb
Tim Peters
tim.peters at gmail.com
Wed Oct 11 03:20:00 CEST 2006
[Tim]
>> Given that, the assert() in question looks fine to me:
>> ...
|>> Either that, or the original author (and me, just above) made an error
>> in analyzing what must be true at this point.
|
[David Hopwood]
> You omitted to state an assumption that sizeof(errTxt) >= 4, since size_t
> (and the constant 4) are unsigned. Also bytes_left must initially be nonnegative
> so that the subexpression 'sizeof(errTxt) - bytes_left' cannot overflow.
I don't care, but that's really the /point/: asserts are valuable
precisely because any inference that's not utterly obvious at first
glance at best stands a good chance of relying on hidden assumptions.
assert() makes key assumptions and key inferences visible, and
verifies them in a debug build of Python.
More information about the Python-Dev
mailing list