Language
Not supported
Syntax the compiler rejects up front, with a located error and a hint.
The compiler validates syntax up front and rejects these with a located error and a hint, rather than miscompiling them:
- Asynchronous generators (an
async defthat yields, and so anasync forover one), asynchronous comprehensions, and anasync definside a function (async def,await,async with, andasync forover a class with__aiter__and__anext__are supported: see JavaScript and async) matchstatements,typealiases,except*, anddelof an attribute or a stepped slicefrom module import *- A generator expression kept in a variable, returned, stored, or passed to the program's own functions, and
print(),len(), orbool()of one: it goes where a builtin, a standard-library call, aforstatement, or a comprehension walks it once (see Limitations) - A class whose base is a builtin value type (
class Stack(list)), an undefined name, or an expression computed when the class statement runs *args,**kwargs, and keyword-only parameters on methods other than__init__,**unpacking in a call, and positional-only parameters (/)- Class keywords other than
metaclass=(__init_subclass__arguments) - Decorators CPython does not define (
@memoize,@timer,@debug,@pure,@type_check,@default_value,@wasm_export), which CPython rejects withNameError - Module-level statements other than definitions. Only definitions run when a module starts:
X = 1,X: int = 1,X = helper(),X = ClassName(),def,class, and imports (atry/except ImportErrorguarded import included). Definitions that are not plain constants are evaluated once, in source order (a module you import, at its first import), when the module is instantiated; one that reads a definition appearing after it is refused, as it is aNameErrorin CPython. A module-level loop,if,try, bare call statement, augmented assignment, tuple unpacking, or write through a subscript or attribute is rejected, because it would otherwise be compiled away and later reads would see the value from before it. Put the code in a function and call it, or drive it fromif __name__ == "__main__":, which is recognized as the entry point - Third-party packages: the supported subset is your own modules plus the standard-library modules listed on the Python subset
If you find a program that compiles and answers differently from CPython, other than as listed under Where the answer differs, that is a bug: please report it.