[Python-Dev] Multiple expression eval in compound if statement?
Anthony Baxter
anthony at interlink.com.au
Mon Jun 13 16:16:00 CEST 2005
On Monday 13 June 2005 21:14, Skip Montanaro wrote:
> Raymond> I think it unwise to allow x to be any expression.
>
> How do you decide what's "too complex"? Even an apparently simple variable
> can have side effects, so the semantic change bit is important no matter
> how complex the expression. (Consider the builtin help object. Type it at
> the prompt with no parens.)
Note also that saying 'just a simple local variable' doesn't cut it, either,
because you will break on something like:
class stupid:
v = 0
def __eq__(self, other):
self.v += 1
return self.v == other
Really, you'd have to make sure you didn't optimise any LHS that defined
a comparision operator (I _think_ that covers all the cases).
Anthony
--
Anthony Baxter <anthony at interlink.com.au>
It's never too late to have a happy childhood.
More information about the Python-Dev
mailing list