This commit is contained in:
BLUELOVETH 2023-05-30 14:49:53 +08:00
parent 35910d32d6
commit d1b06f0633
3 changed files with 33 additions and 2 deletions

View File

@ -6,7 +6,6 @@
<img alt="GitHub" src="https://img.shields.io/github/license/blueloveth/pocketpy.svg?color=blue"></a>
<a href="https://github.com/blueloveth/pocketpy/releases">
<img alt="GitHub release" src="https://img.shields.io/github/release/blueloveth/pocketpy.svg"></a>
<a title="Pub" href="https://pub.dev/packages/pocketpy" ><img src="https://img.shields.io/pub/v/pocketpy" /></a>
</p>
**English |** [**简体中文**](README_zh.md)

View File

@ -6,7 +6,6 @@
<img alt="GitHub" src="https://img.shields.io/github/license/blueloveth/pocketpy.svg?color=blue"></a>
<a href="https://github.com/blueloveth/pocketpy/releases">
<img alt="GitHub release" src="https://img.shields.io/github/release/blueloveth/pocketpy.svg"></a>
<a title="Pub" href="https://pub.dev/packages/pocketpy" ><img src="https://img.shields.io/pub/v/pocketpy" /></a>
</p>
pocketpy是一个轻量级的Python解释器为嵌入至游戏引擎而设计基于C++17和STL。

View File

@ -0,0 +1,33 @@
---
icon: dot
title: Comparison with CPython
order: 99
---
[cpython](https://github.com/python/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.
## Unimplemented features
1. `**kwargs` in function definition.
2. `__getattr__` and `__setattr__`.
3. Descriptor protocol `__get__` and `__set__`. However, `@property` is implemented.
4. `__slots__` in class definition.
5. `import` module from a directory with `__init__.py`.
6. One element tuple. `(1,)` is not supported.
7. Unpacking in `list` and `dict` literals, i.e. `[1, 2, *a]`.
8. Access the exception object in try..except.
## Different behaviors
1. positional and keyword arguments are strictly evaluated.
2. When a generator is exhausted, `StopIteration` is returned instead of raised.
3. `++i` and `--j` is an increment/decrement statement, not an expression.