mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-24 05:20:17 +00:00
1.8 KiB
1.8 KiB
| icon | title | order |
|---|---|---|
| dot | Comparison with CPython | 99 |
cpython is the reference implementation of the Python programming language. It is written in C and is the most widely used implementation of Python.
The design goal
pkpy aims to be an alternative to lua for game scripting, not cpython for general purpose programming.
- For syntax and semantics, pkpy is designed to be as close to cpython as possible.
- For ecosystem and others, pkpy is not compatible with cpython.
pkpy supports most of the syntax and semantics of python. For performance and simplicity, some features are not implemented, or behave differently. The easiest way to test a feature is to try it on your browser.
Unimplemented features
- Descriptor protocol
__get__and__set__. However,@propertyis implemented. __slots__in class definition.elseclause in try..except.- Inplace methods like
__iadd__and__imul__. __del__in class definition.- Multiple inheritance.
Different behaviors
- positional and keyword arguments are strictly evaluated.
intdoes not derive frombool.intis 64-bit.- Raw string cannot have boundary quotes in it, even escaped. See #55.
- In a starred unpacked assignment, e.g.
a, b, *c = x, the starred variable can only be presented in the last position.a, *b, c = xis not supported. - A
Tabis equivalent to 4 spaces. You can mixTaband spaces in indentation, but it is not recommended. %,&,//,^and|forintbehave the same as C, not python.str.splitandstr.splitlineswill remove all empty entries.- A return, break, continue in try/except block will make the finally block not executed.