[Python-Dev] peps: Update PEP 399 to include comments from python-dev.

Stefan Behnel stefan_ml at behnel.de
Wed Apr 13 09:06:30 CEST 2011


Georg Brandl, 13.04.2011 08:54:
> On 13.04.2011 02:07, Antoine Pitrou wrote:
>> On Tue, 12 Apr 2011 19:50:34 -0400
>> Tres Seaver wrote:
>>> Trying to accelerate existing code which doesn't have the coverage is
>>> insane:  how can you know that the accelerator doesn't subtly change the
>>> semantics without tests?
>>
>> Well, why do you think tests guarantee that the semantics are the same?
>> Tests are not a magic bullet. "Covering" a code path doesn't ensure
>> that every possible behaviour is accounted for.
>
> def foo(a, b):
>      if condition(a):
>          bar = b
>      do_something_with(bar)
>
> This has 100% coverage if "condition" is usually true :)

I understand that you are joking. However, the PEP mentions *branch* 
coverage as the 100% goal, which would imply that the above issue gets caught.

Stefan



More information about the Python-Dev mailing list