Python Language Reference Coverage¶
This is a 1:1 mapping of the features listed in https://docs.python.org/3/reference/ and their support in TorchScript. The categorizations are as follows:
Section |
Status |
Note |
---|---|---|
Not Relevant |
||
Not Relevant |
||
Not Relevant |
||
Not Relevant |
||
Not Relevant |
||
Not Relevant |
||
Supported |
||
Supported |
||
Not Supported |
TorchScript explicitly don’t support unicode |
|
Supported |
||
Supported |
||
Supported |
||
Supported |
||
Not Relevant |
||
Not Relevant |
||
Supported |
||
Supported |
||
Supported |
||
Not Relevant |
||
Supported |
||
Supported |
||
Partially Supported |
||
Supported |
||
Supported |
||
Supported |
||
Not Supported |
||
Partially Supported |
Not supported: |
|
Partially Supported |
Not supported: |
|
Not Relevant |
||
Not Relevant |
||
Partially Supported |
Not supported: NotImplemented, Ellipsis, numbers.Complex, bytes, byte arrays, sets, frozen sets, generators, coroutines, async generators, modules, I/O objects, internal objects, slice objects ( though slicing is supported), classmethod |
|
Supported |
||
Partially Supported |
Not supported: |
|
Not Supported |
||
Not Supported |
||
Not Supported |
||
Not Supported |
||
Not Supported |
||
Not Supported |
||
Not Supported |
||
Not Supported |
||
Not Supported |
|
|
Not relevant |
||
Not relevant |
||
Not relevant |
||
Not relevant |
||
Not relevant |
||
Not Supported |
||
Not Supported |
||
Supported |
||
Partially Supported |
Some magic methods not supported (e.g. |
|
Partially Supported |
Magic methods with swapped operands not supported ( |
|
Not Supported |
||
Not relevant |
||
Not Supported |
||
Not Supported |
||
Not Supported |
||
Not Supported |
||
Not Supported |
||
Not Relevant |
||
Not Relevant |
||
Not Relevant |
Names are bound at compile time in TorchScript |
|
Not Relevant |
See |
|
Not Relevant |
See |
|
Not Relevant |
||
Not Supported |
Python values cannot be captured |
|
Partially Supported |
See |
|
Not Relevant |
||
Not Relevant |
See expressions section |
|
Supported |
||
Not Relevant |
||
Supported |
||
Partially Supported |
|
|
Supported |
||
Partially Supported |
Not supported: comprehension ifs, async iterators |
|
Supported |
||
Not Supported |
||
Supported |
dict() constructor with kwargs doesn’t work, dict comprehensions, dictionary unpacking |
|
Not Supported |
||
Not Supported |
||
Not Supported |
||
Not Supported |
||
Not Supported |
||
Not Supported |
||
Supported |
||
Supported |
||
Supported |
||
Partially Supported |
Tuple slicing with stride is not supported |
|
Partially Supported |
Args unpack / kwargs unpack is not supported |
|
Not Supported |
||
Supported |
||
Partially Supported |
Some bitwise operators are not implemented for primitive types (e.g. |
|
Partially Supported |
See delimiters section |
|
Not Supported |
||
Supported |
||
Supported |
||
Partially Supported |
Dictionary equality checks are not currently supported |
|
Partially Supported |
Not supported for TorchScript classes |
|
Supported |
||
Supported |
||
Supported |
||
Not Supported |
||
Partially Supported |
Iterable unpacking not supported |
|
Supported |
||
Supported |
||
Supported |
||
Supported |
||
Supported |
||
Partially Supported |
See delimiters section |
|
Supported |
||
Partially Supported |
Exception message is not customizable |
|
Supported |
||
Not Supported |
||
Supported |
Some other features of returning (e.g. behavior with try..finally) are unsupported |
|
Not Supported |
||
Partially Supported |
Exception message is not customizable |
|
Supported |
Some other features of returning (e.g. behavior with try..finally) are unsupported |
|
Supported |
Some other features of returning (e.g. behavior with try..finally) are unsupported |
|
Not Supported |
||
Not Supported |
||
Not Supported |
||
Not Supported |
||
Irrelevant |
||
Supported |
||
Partially Supported |
while..else is not supported |
|
Partially Supported |
for..else is not supported |
|
Not Supported |
||
Supported |
||
Not Supported |
||
Not Supported |
||
Not Supported |
||
Not Supported |
||
Not Supported |
||
Not Supported |
||
Not Relevant |
||
Not Relevant |
||
Not Relevant |
||
Not Relevant |
||
Not Relevant |