[Python-Dev] Can Python implementations reject semantically invalid expressions? (original) (raw)
Greg Ewing greg.ewing at canterbury.ac.nz
Sat Jul 3 03:39:07 CEST 2010
- Previous message: [Python-Dev] Can Python implementations reject semantically invalid expressions?
- Next message: [Python-Dev] Can Python implementations reject semantically invalid expressions?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Stefan Behnel wrote:
So, would it still be Python if it folded
1 + "1" into raise TypeError() at compile time?
It would have to be
raise TypeError("Exactly the message that would have been produced at run time")
That might be acceptable, but then you have to ask, is it really worth performing this optimisation? The overhead of raising and handling the exception is likely to completely swamp that of executing the original code.
-- Greg
- Previous message: [Python-Dev] Can Python implementations reject semantically invalid expressions?
- Next message: [Python-Dev] Can Python implementations reject semantically invalid expressions?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]