TE
科技回声
首页
24小时热榜
最新
最佳
问答
展示
工作
中文
GitHub
Twitter
首页
Pointers.py: Bringing the hell of pointers to Python
2 点
作者
ScottWRobinson
大约 3 年前
1 comment
compressedgas
大约 3 年前
Python already has this 'hell of pointers' in the ctypes module.<p>Where `to_ptr(x)` is:<p><pre><code> ptr = ctypes.pointer(ctypes.py_object(x)) </code></pre> And `ptr.dereference()` is:<p><pre><code> ptr.contents.value</code></pre>