A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2010-July/101380.html below:

[Python-Dev] Can Python implementations reject semantically invalid expressions?

[Python-Dev] Can Python implementations reject semantically invalid expressions? [Python-Dev] Can Python implementations reject semantically invalid expressions?Greg Ewing greg.ewing at canterbury.ac.nz
Sat Jul 3 03:39:07 CEST 2010
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
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4