Comparison with CPython
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.
- Descriptor protocol
__slots__in class definition.
- Access the exception object in try..except.
elseclause in try..except.
- Inplace methods like
__del__in class definition.
- Multiple inheritance.
- positional and keyword arguments are strictly evaluated.
- When a generator is exhausted,
StopIterationis returned instead of raised.
--jis an increment/decrement statement, not an expression.
intdoes not derive from
intis 64-bit. You can use
longtype explicitly for arbitrary sized integers.
__ne__is not required. Define
- 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.
Tabis equivalent to 4 spaces. You can mix
Taband spaces in indentation, but it is not recommended.
intbehave the same as C, not python.