TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Python Internals: PyObject

169 pointsby kerckeralmost 9 years ago

5 comments

harrisialmost 9 years ago
Although it&#x27;s been posted here (only twice, though!) before, Philip Guo put up a 10-hour series of lectures on CPython internals[0]. I am nearly done with them, and have found them very useful and well-paced. Posting here because the author of this article seems to have stopped the series, and anyone interested in this stuff should definitely check out the Guo lectures.<p>[0]: <a href="http:&#x2F;&#x2F;pgbovine.net&#x2F;cpython-internals.htm" rel="nofollow">http:&#x2F;&#x2F;pgbovine.net&#x2F;cpython-internals.htm</a>
评论 #12185089 未加载
评论 #12185839 未加载
评论 #12185321 未加载
dfoxalmost 9 years ago
Contrary to what the article says, PyVarObject is still PyObject at the same time and PyVarObjects have nothing to do with mutability (certainly, it&#x27;s trivialy obvious that not all PyVarObjects are mutable as immutable tuples are PyVarObjects, while mutable lists are not)<p>The thing that is handled by PyVarObject are types whose instances can differ in their size, with tuple and bytes objects being probably most common cases when it is used.
partycoderalmost 9 years ago
If you try to embed or extend Python in C you will be exposed to PyObject very quickly. The official Python documentation can walk you through that process (visit the embedding or extending parts). The PyObject structure mentioned in the article also comes with many functions to manage them programatically, cast them to other types, etc.
评论 #12185458 未加载
denfromufaalmost 9 years ago
Here is blog post about python list implementation, one of 2 main data structures used internally: <a href="http:&#x2F;&#x2F;www.laurentluce.com&#x2F;posts&#x2F;python-list-implementation&#x2F;" rel="nofollow">http:&#x2F;&#x2F;www.laurentluce.com&#x2F;posts&#x2F;python-list-implementation&#x2F;</a>
denfromufaalmost 9 years ago
Cython can be used to auto-generate optimized Python C-API code that gets source-mapped line by line to original Cython code in the form of HTML annotations. This stuff is very hard to write by hand.