[Python-Dev] Code Generation Idea Was: Bytecode idea
Guido van Rossum
guido@python.org
Wed, 26 Feb 2003 11:14:35 -0500
> Would it be simpler to institute a special rule that True = 1 is silently
> ignored, but True = anything else generates an error message? Or am I
> overlooking something important?
Some people prefer
True = (1 > 0)
because this accesses the special integer (with value 1) that is used
by the interpreter for the outcome of boolean results .
> If you want to handle assigning to True an expression whose value is
> known only at run time, translate it into
>
> if expression != 1 :
> raise Exception, "Attempt to assign invalid value to True"
>
> which would give a run-time error without costing cycles anywhere else.
I suggest you try coming up with a patch for that to see how much work
it is. I expect it to be tough.
--Guido van Rossum (home page: http://www.python.org/~guido/)