Python
Java
PHP
IOS
Android
Nodejs
JavaScript
Html5
Windows
Ubuntu
Linux
是否可以恢复损坏的“interned”字节对象
众所周知 小bytes 对象由 CPython 自动 驻留 类似于intern https docs python org 3 library sys html sys intern 字符串函数 更正 As 解释了 https stacko
python
python3x
cpython
pythoninternals
Python 如何实现其类型对象,即类型类型始终是类型?
我知道Python中的所有东西都是一个对象 并且这些对象的 类型 或类 是 类型 另外 类型的类型也是类型本身 正如解释得很好here http www cafepy com article python types and objects
python
types
Implementation
cpython
pyobject
如何创建带有 abi 标签的完整轮子?
尝试从一个空项目创建一个轮子 使用这个setup py setup py from setuptools import setup setup name bla version 1 我调用python setup py bdist whee
python
setuptools
cpython
ABI
pythonwheel
为什么 Python 代码在函数中运行得更快?
def main for i in xrange 10 8 pass main 这段代码在Python中运行 注 计时是用Linux中BASH中的time函数完成的 real 0m1 841s user 0m1 828s sys 0m0 0
python
performance
profiling
benchmarking
cpython
Python 字节码在 CPython 中运行究竟如何?
我试图了解 Python 是如何工作的 因为我一直在使用它 据我了解 当您运行 python script py 之类的东西时 脚本会转换为字节码 然后解释器 VM CPython 实际上只是一个 C 程序 读取 python 字节码并相应
python
cpython
pythoninternals
如何从 Cython 调用 C-API 函数,例如 PyUnicode_READ_CHAR?
我正在使用 Cython 来加速对字符串 unicode CPython 3 6 进行操作的函数 我如何调用 CPythonPy UCS4 val PyUnicode READ CHAR my string my index 来自我的 Cy
python
Cython
cpython
Python 如何以及何时确定变量的数据类型? [复制]
这个问题在这里已经有答案了 我试图弄清楚 Python 3 使用 CPython 作为解释器 到底是如何执行其程序的 我发现步骤是 通过 CPython 编译器将 Python 源代码 py 文件 编译为 Python 字节码 pyc 文件
python
python3x
virtualmachine
cpython
Python @property.setter
创建装饰器的基本方法是 def my decorator f def f args kwargs do something using f pass return f my decorator def f 但这样你就不能定义像这样的装饰器
python
cpython
pythondecorators
为什么Python for循环中的临时变量计算会占用这么多内存? [复制]
这个问题在这里已经有答案了 下面两段代码是等价的 但是第一个代码占用了大约700M内存 后一个代码只占用了大约100M内存 通过Windows任务管理器 这里会发生什么 def a lst for i in range 10 7 t a t
python
cpython
CPython - 如何使用 __dict__ 创建方法属性并将其添加到对象?
这可能是一个棘手的问题 简而言之 我正在创建并添加一个方法 如下所示 static PyObject ret arg PyBVHTree self PyObject arg just to demonstrate return arg st
python
cpython
Python中的栈是什么?
Python 中的 堆栈 是什么 是CPython的C栈吗 我读到Python 堆栈帧是在堆中分配的 但我认为堆栈的目标是 堆栈堆栈帧 那么堆栈做什么呢 Python的栈帧是在堆上分配的 但它们相互链接形成一个堆栈 当函数a调用函数b th
python
cpython
pythoninternals
递归日志记录导致 Python 3 中的解释器崩溃
以下代码记录错误并调用自身 导致堆栈溢出并最终导致 Python 3 6 中的核心转储 gt gt gt import logging gt gt gt def rec logging error foo rec gt gt gt rec
python
python3x
logging
python36
cpython
提取 SWIG 包装的 C++ 实例/指针以在 Cython 中使用
我有一个来自 SWIG 包装的 C 库的类实例 我想从中提取其引用 以便能够在 Cython 文件中使用它 在该文件中我通过使用同类中更轻量级的自制 Cython 包装器 我知道这不像访问某些隐藏属性那么容易 但我想 SWIG 或 CPyt
python
c
SWIG
Cython
cpython
在运行时动态设置Python解释器优化
经过一段时间在这里寻找重复项后 我发现唯一的事情是无操作并使用 Cython 进行优化 这是完全不相关的 我想要完成的是动态设置python O运行时标记 基本上 有一个值sys flags optimize这是只读的 我正在寻找一个选项来
python
compileroptimization
assert
interpreter
cpython
CPython 中的模块加载是如何工作的?
CPython 中的模块加载在幕后是如何工作的 特别是 用 C 语言编写的扩展的动态加载是如何工作的 我可以在哪里了解这方面的信息 我发现源代码本身相当令人难以承受 我可以看到那个值得信赖的人dlopen 和朋友在支持它的系统上使用 但没有
python
pythonimport
cpython
dynamicloading
pythoninternals
变量名称如何在内部存储和映射?
I read https stackoverflow com a 19721096 1661745 https stackoverflow com a 19721096 1661745在 CPython 中 变量似乎只是与引用相关联的名称
python
variables
cpython
pythoninternals
C Python API 扩展忽略 open(errors="ignore") 并始终抛出编码异常
给定一个文件 myfiles file with invalid encoding txt无效的 UTF8 为 parse this correctly F B r also parse this correctly 我正在使用内置的Pyt
python
c
cpython
pythoncapi
CPython 源 - 如何构建静态 python26.lib?
我正在尝试使用 Cython 将 hello pyx 文件编译为 exe 第一步是使用命令 cython cplus embed hello pyx 将 hello pyx 编译为 hello cpp 文件 Embed选项意味着Genera
python
Compilation
staticlinking
Cython
cpython
如何生成可重复的随机数序列?
我想要一个可以生成伪随机值序列的函数 但该序列每次运行都是可重复的 我想要的数据必须在给定范围内相当好的随机分布 它不一定是完美的 我想编写一些代码 根据随机数据对其运行性能测试 我希望每台机器上的每次测试运行的数据都相同 但由于存储原因
python
Random
cpython
嵌入 CPython:如何构造 Python 可调用对象来包装 C 回调指针?
假设我将 CPython 解释器嵌入到一个用 C 编写的较大程序中 该程序的 C 组件偶尔需要调用用 Python 编写的函数 并将回调函数作为参数提供给它们 使用 CPython扩展和嵌入 https docs python org 3
python
c
cpython
pythoncapi
«
1
2
3
4
»