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

Cesare Di Mauro cesare.dimauro at a-tono.com
Tue Apr 7 17:19:10 CEST 2009


In data 07 aprile 2009 alle ore 17:19:25, <skip at pobox.com> ha scritto:
>> Cesare> The only difference at this time is regards invalid operations,
> Cesare> which will raise exceptions at compile time, not at running
> Cesare> time.
>> Cesare> So if you write:
>> Cesare> a = 1 / 0
>> Cesare> an exception will be raised at compile time.
>> I think I have to call *bzzzzt* here. This is a common technique used
> during debugging. Insert a 1/0 to force an exception (possibly causing the
> running program to drop into pdb). I think you have to leave that in.
>> Skip

Many tests rely on this, and I have changed them from something like:
try:
 1 / 0
except:
 ....
to
try:
 a = 1; a / 0
except:
 ....
But I know that it's a major source of incompatibilities, and in the final
code I'll enabled it only if user demanded it (through a flag).
Cesare


More information about the Python-Dev mailing list

AltStyle によって変換されたページ (->オリジナル) /