[Python-Dev] pyc files, constant folding and borderline portability issues

Guido van Rossum guido at python.org
Tue Apr 7 19:22:15 CEST 2009


On Tue, Apr 7, 2009 at 9:46 AM, Cesare Di Mauro
<cesare.dimauro at a-tono.com> wrote:
> On Tue, Apr 7, 2009 06:25PM, Guido van Rossum wrote:
>> Well I'm sorry Cesare but this is unacceptable. As Skip points out
>> there is plenty of code that relies on this.
>
> Guido, as I already said, in the final code the normal Python behaviour
> will be kept, and the stricter one will be enabled solely due to a flag
> set by the user.

Ok.

>> Also, consider what
>> "problem" you are trying to solve here. What is the benefit to the
>> user of moving this error to compile time? I cannot see any.
>>
>> --Guido
>
> In my experience it's better to discover a bug at compile time rather than
> at running time.

That's my point though, which you seem to be ignoring: if the user
explicitly writes "1/0" it is not likely to be a bug. That's very
different than "1/x" where x happens to take on zero at runtime --
*that* is likely  bug, but a constant folder can't detect that (at
least not for Python).

-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-Dev mailing list