社区所有版块导航
Python
python开源   Django   Python   DjangoApp   pycharm  
DATA
docker   Elasticsearch  
aigc
aigc   chatgpt  
WEB开发
linux   MongoDB   Redis   DATABASE   NGINX   其他Web框架   web工具   zookeeper   tornado   NoSql   Bootstrap   js   peewee   Git   bottle   IE   MQ   Jquery  
机器学习
机器学习算法  
Python88.com
反馈   公告   社区推广  
产品
短视频  
印度
印度  
私信  •  关注

Caglar Toklu

Caglar Toklu 最近创建的主题
Caglar Toklu 最近回复了
15 年前
回复了 Caglar Toklu 创建的主题 » 使用python语法的子集加速编写c程序

如果C++是对的,与Cython和Pyrx不同, Shed Skin 习惯于 转换 Python的一个子集到C++,并用St/G++编译它。“python的子集”意味着您编写的所有代码仍然是python,但是您不能使用python的所有模块(实际上您只能使用其中的一些模块),也不能使用一些过于动态的东西。由于代码转换为C++,用G++编译,这是相当公平的。

例如:

# Actually, in Python, this is one line:
matrix = [[1, 2, 3], [4, 5, 6]]
zipped = zip(*matrix)
# But, Shed Skin has some restrictions for this, so you have:
matrix = [[1, 2, 3], [4, 5, 6]]
zipped = zip(matrix[0], matrix[1])

Shed Skin使用类型推断,所以,

x = 4.0 # OK
x = 5.0 # OK
x = "foo" # OK in Python, but Shed Skin will not compile this

我必须警告你,即使开发是积极的,它仍处于试验阶段。