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/101299.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?"Martin v. Löwis" martin at v.loewis.de
Fri Jul 2 06:42:31 CEST 2010
> We know that many semantic errors in Python lead to runtime errors, e.g. 
> 1 + "1". If an implementation rejected them at compile time, would it 
> still be Python? E.g. if the keyhole optimizer raised SyntaxError (or 
> some other exception) on seeing this:
> 
> def f():
>     return 1 + "1"
> 
> instead of compiling something which can't fail to raise an exception, 
> would that still be a legal Python implementation?

I'd say "no". Any syntactically correct module should start executing,
and type errors are only a runtime concept.

If you were to reject code at startup more restrictively, you might
end up rejecting the standard library, as it contains syntax errors
in code that isn't being imported normally (test/badsyntax*).

Regards,
Martin

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