Live data from Hacker News

CPython Internals Explained

github.com

31–40 of 54 posts

Re: CPython Internals Explained

#31
post #29

Earlier quoted context omitted.

Just to name alternatives: Cpython, Pypy, jython, ironpython. Then, there quite a few python-likes out there. I wish they would stay precise.

Also: https://micropython.org/

Another great example that no one would confuse for python.

Re: CPython Internals Explained

#32
post #11

Earlier quoted context omitted.

Just to name alternatives: Cpython, Pypy, jython, ironpython. Then, there quite a few python-likes out there. I wish they would stay precise.

CPython, pypy, jython are not alternatives. CPython is Python. The others are attempts.

I don’t think it’s good form to downvote people you disagree with.

Re: CPython Internals Explained

#33
post #5

I wish they would just go back to calling it Python, since it’s the Python that everyone knows and uses. No one gets confused over Python the spec and Python the implementation. Every time I see “CPython” i have to double check we’re just talking about Python. I guess they “CPython’ed” back when people thought Jython would take off , and it never did because Java sucks.

I feel like when the goal is to talk about the internals of it, then it makes sense to call it CPython.

In general, I never, ever see anyone saying "I will write a CPython script". Everybody says "Python" in my experience... do you see it differently?

EDIT: I don't think that your opinion deserves to be downvoted, though...

Re: CPython Internals Explained

#34
post #32
post #11

Earlier quoted context omitted.

CPython, pypy, jython are not alternatives. CPython is Python. The others are attempts.

I don’t think it’s good form to downvote people you disagree with.

I did not downvote, but I'm guessing that it is perceived as disrespectful to call them failures to the point where they don't even qualify as "alternatives".

Re: CPython Internals Explained

#35
post #4

I've been comparing various platforms and discussing them with ChatGPT—for instance, why Python's execution is slower than JavaScript's V8. It claimed this is due to mtechnical debt and the inability to change because libraries like NumPy bypass public interfaces and access data directly. I'm wondering how much of that is true and what is just a hallucination." Btw: JavaScript seems to have similar complexity issues.…

For what it's worth, I really don't get the downvotes. I think it is an interesting question, and it brought interesting answers.

No clue if that's the reason for the downvotes, but maybe next time don't mention ChatGPT and just formulate this as "From what I read, [...]".

Re: CPython Internals Explained

#36
post #34
post #32

Earlier quoted context omitted.

I don’t think it’s good form to downvote people you disagree with.

I did not downvote, but I'm guessing that it is perceived as disrespectful to call them failures to the point where they don't even qualify as "alternatives".

The word "failure" was never used.

But, they are technically correct. The language is defined as by CPython: it is the standard!!! None of the others fully meet that standard, which includes quirks! It's knows trade offs with them! They are, literally, attempts to adhere to that standard.

Re: CPython Internals Explained

#37
post #8

Earlier quoted context omitted.

It is not that numpy bypasses public interfaces. It uses documented C APIs. V8, as far as I know, does not have that.

V8 itself might not, but, say, Node does and that doesn't torpedo performance. Was Node-API just better designed than Python's FFI?

My understanding is that Node still doesn’t give you low-level C APIs into the language itself. It gives you JavaScript APIs that call into I/O libraries (libuv basically).

Python it’s not hard to write a module in pure C that manipulates other Python objects. This means the representation of Python objects has to be stable enough for the C code. V8 does not allow that.

Re: CPython Internals Explained

#39

Had to write a fairly substantial native extension to Python a couple years ago and one of the things I enjoyed was that the details were not easily "Googleable" because implementation results were swamped by language level results. It took me back to the old days of source diving and accumulated knowledge that you carried around in your head. https://www.dave.org/posts/20220806_python/

Great write up, thank you for sharing it! Quick question though, in your first code example (dynamic enum with a metaclass) what is "m" in this line towards the start?

    Py_DECREF(m)
Is it the metaclass?

Re: CPython Internals Explained

#40
post #5

I wish they would just go back to calling it Python, since it’s the Python that everyone knows and uses. No one gets confused over Python the spec and Python the implementation. Every time I see “CPython” i have to double check we’re just talking about Python. I guess they “CPython’ed” back when people thought Jython would take off , and it never did because Java sucks.

I find it's usually referred to as CPython when discussing something specific to the implementation or internals of Python that don't apply to Pypy, which seems to be the alternative Python implementation with the most traction.

No harm in being explicit right? Tis part of the zen of Python after all.

Post reply on HN