Hacker GitHub

← All repos

python/cpython

View on GitHub ↗ ★ 77,791 Python

The Python programming language

548 mentions on Hacker News by 400 people: 44 stories, 504 comments · first 2014-12-30 · latest 2026-10-27

Mentions per year 548 mentions · busiest year 2025 (72)
20082026
  1. Depends on the area of the code you look at, but they can be fairly sparse, yes: https://github.com/python/cpython/blob/master/PC/python_uwp.... I'd say that redis is probably a better example of gold standard clean C code, though, and…
    comment by pytester · 2019-11-10 · in Keep your source code SIMPLE
  2. …it sound like this line of documentation has been in place since the library was first written. https://github.com/python/cpython/commit/52465e1b8bb7af23d64... Edit: Correct commit from 2015 https://github.com/python/cpython/commit/9f3c094e…
  3. The mail is from 2010 but it was only implemented in 2016, I wonder why. Found the link in https://github.com/python/cpython/blob/master/Objects/dictob... .
  4. …it strictly more complex. [1]: https://github.com/chucksmash/jsonish/blob/master/jsonish/to... [2]: https://github.com/python/cpython/blob/41c57b335330ff48af098...
    comment by chucksmash · 2019-09-29 · in JSON for Modern C++
  5. …python algo does not get slow when n is large. The k~n case obviously calls for inverse selection. https://github.com/python/cpython/blob/master/Lib/random.py#...
    comment by avip · 2019-09-13 · in Algorithm No One Knows About (2016)
  6. …derivative works, distribute, and otherwise use Python alone or in any derivative version" (from: https://github.com/python/cpython/blob/2.7/LICENSE ) It you're uptight because the PSF owns and protects the trademark to the name "Python"…
    comment by bigiain · 2019-09-09 · in Sunsetting Python 2
  7. …able to be characterised as "grabbing it out of the hands of people still using it"??? Here: https://github.com/python/cpython/tree/2.7 Join the other 11.5k people who've forked it on Github, and an unknown number of people who've cloned…
    comment by bigiain · 2019-09-09 · in Sunsetting Python 2
  8. …to file a bug, but they found out it already exists, just hasn't been merged into the 2.x tree. - https://github.com/python/cpython/commit/46ed90dd014010703c7... - https://github.com/python/cpython/pull/13638 -…
    comment by drej · 2019-09-09 · in Sunsetting Python 2
  9. …are object pointers, too. CPython just so happens to preallocate a range of small integers[0]. [0]: https://github.com/python/cpython/blob/master/Objects/longob...
    comment by hope-striker · 2019-09-05 · in Rust in Large Organizations
  10. …a negative value is beyond the scope of python. Python is making use of malloc/free under the hood: https://github.com/python/cpython/blob/master/Objects/obmall... There's some flexibility for wrapping free in different ways in that file,…
    comment by CogitoCogito · 2019-08-05 · in Memory Management in Python
  11. …sense. On balance it removes several hundred lines and often makes the code much clearer, e.g. https://github.com/python/cpython/pull/8122/files#diff-78e8e...
    comment by orangecat · 2019-07-17 · in What's Coming in Python 3.8
  12. [-5, 256]: https://github.com/python/cpython/blob/master/Objects/longob...
  13. …) Reading the source of your favorite interpreted programming language can be rewarded, e.g. https://github.com/python/cpython
  14. …For example: `Callback = typing.Callable[[str], Callback]` and `Foo = Union[str, List['Foo']]`. [0] https://github.com/python/cpython/blob/3.8/Lib/typing.py#L15... [1] https://github.com/python/mypy/issues/731 [2]…
  15. …surprised by the number of gotos in the Python runtime. The link in the article was down so here: https://github.com/python/cpython/search?q=goto There's a lot of "goto exit" which is obviously a CPython runtime convention - fair enough.…
    comment by ridiculous_fish · 2019-05-23 · in Goto and the folly of dogma (2018)
  16. Especially when you start looking at the code for some of these https://github.com/python/cpython/blob/master/Lib/imghdr.py
  17. …with a type annotation". (I highlighted the relevant line of the grammar for you in the link.) [0] https://github.com/python/cpython/blob/master/Grammar/Gramma...
    comment by DonaldPShimoda · 2019-05-15 · in Things to use in Python 3
  18. https://github.com/python/cpython/search?utf8=%E2%9C%93&q=kl...
    comment by qwsxyh · 2019-04-19 · in Interface Dispatch (2018)
  19. …docstrings. CPython's compilation pipeline just has a fairly straightforward peephole optimiser: https://github.com/python/cpython/blob/master/Python/peephol...
    comment by masklinn · 2019-02-25 · in The CPython Bytecode Compiler Is Dumb
  20. …in Parser/tokenizer.c[1]. [0]: https://docs.python.org/3/reference/lexical_analysis.html#in... [1]: https://github.com/python/cpython/blob/master/Parser/tokeniz...
    comment by kbirkeland · 2019-02-23 · in Full Python 3 Grammar Specification
  21. …in stdlib https://bugs.python.org/issue35582 . namedtuple attr access is also now 1.7x faster https://github.com/python/cpython/pull/10495 Other performance improvments : https://github.com/python/cpython/pulls?q=is%3Apr+sort%3Aupd...
  22. …own simplified instruction set. For an example instruction set, check out Python's header file at https://github.com/python/cpython/blob/master/Include/opcode...
  23. itemgetter and attrgetter are compiled C functions called by cpython https://github.com/python/cpython/blob/master/Modules/_opera...
  24. …a contiguous segment of memory of python object references? Yep, it is an array of pointers: https://github.com/python/cpython/blob/3.7/Include/listobjec... > And when the list needs to be resized and doubles itself, it's just doubling the…
  25. …placing a comma-separated list of expressions in square brackets" CPython implementation is here: https://github.com/python/cpython/blob/e42b705188271da108de4... If I'm talking about arrays with someone else, I would expect us to be…
  26. …using constant offsets from the stack pointer. Here is the code for the normal call fast path: https://github.com/python/cpython/blob/62be74290aca26d16f3f5... f = _PyFrame_New_NoTrack(tstate, co, globals, NULL); if (f == NULL) { return…
    comment by tom_mellior · 2018-12-19 · in Reasons Python Sucks
  27. ….pth files??!?! Ever been curious how sys.path gets populated at startup? Gaze into the darkness: https://github.com/python/cpython/blob/master/PC/getpathp.c And to anyone saying "Just use a virtualenv": that is so, so not an answer to…
    comment by sebastos · 2018-12-18 · in Reasons Python Sucks
  28. It's "of", rather than "in"... this is probably the Python one mentioned: https://github.com/python/cpython/blob/d7538dd5e3e04a8db22e1...
    comment by tom_ · 2018-12-14 · in Write Your Own Virtual Machine
  29. …is not automatically generated. But I don't know enough C to say for sure, maybe someone else can. https://github.com/python/cpython/blob/9dfa0fe587eae3626ffc9...
    comment by dec0dedab0de · 2018-10-11 · in Asterisks in Python
  30. …bytecode contained in PyCodeObjects. This layering is even visible in the Python source itself ( https://github.com/python/cpython/tree/v3.7.0 ) - the first three things live under ./Objects in the source tree, and the parser and the…
  31. …PyNumber_Add(left, right) Line 1495 is PyNumber_InPlaceAdd(left, right) Those go to: PyNumber_Add https://github.com/python/cpython/blob/874809ea389e6434787e7... PyNumber_InPlaceAdd https://github.com/python/cpython/blob/874809ea389e6434787…
  32. …want to test your theory, you can look at the implementation of those opcodes. Here's INPLACE_ADD: https://github.com/python/cpython/blob/874809ea389e6434787e7... And here's BINARY_ADD: https://github.com/python/cpython/blob/874809ea389e643…
  33. …difference now, does it? Proof: Process Pool worker, returning the result by using `outqueue.put()` https://github.com/python/cpython/blob/86b89916d1b0a26c1e77f... multiprocessing Queue, initializing a Pipe…
    comment by devxpy · 2018-08-25 · in Parallel Programming with Python
  34. actually, by using Python you explicitly agree that PSF doesn't owe you anything :) https://github.com/python/cpython/blob/master/LICENSE 4. PSF is making Python available to Licensee on an "AS IS" basis. PSF MAKES NO REPRESENTATIONS OR…
    comment by xj9 · 2018-07-19 · in Python post-Guido
  35. I was going to say - its application in this while loop is really nice I think: https://github.com/python/cpython/pull/8122/files#diff-0ad86...
    comment by 2T1Qka0rEiPr · 2018-07-06 · in How PEP-572 would change the standard library
  36. Python is using Git these days: https://github.com/python/cpython/blob/master/Objects/listob...
  37. …code, both `extract` and `extractall` call `_extract_member` which sanitizes the file paths. See https://github.com/python/cpython/blob/3.6/Lib/zipfile.py
    comment by ishi · 2018-06-05 · in Zip Slip Vulnerability
  38. …some group, somewhere will champion 2.7. And maybe in ~2030 we'll still see active support. [1] https://github.com/python/cpython/tree/2.7
    comment by wyldfire · 2018-05-15 · in Guide to Data Classes in Python 3.7
  39. Should be https://github.com/python/cpython/blob/2.7/Misc/NEWS.d/2.7.1... , I think.
    comment by eesmith · 2018-05-01 · in Python 2.7.15 release
  40. https://github.com/python/cpython/blob/2.7/Misc/NEWS.d/2.7.1...
    comment by frewsxcv · 2018-05-01 · in Python 2.7.15 release
  41. …full of macros and gotos, not to mention being 5000 lines long. The interpreter loop starts here: https://github.com/python/cpython/blob/master/Python/ceval.c... So I appreciate seeing the algorithm laid out in Python. In particular it…
  42. …injection style is pretty much equivalent to functional programming. Python is described with ASDL: https://github.com/python/cpython/blob/master/Parser/Python.... ASDL has some relation to "Stanford University Intermediate Format", which…
  43. …of Free Software licensing work. You are absolutely able to go clone their git repo right now ( https://github.com/python/cpython ) and work on it as your own. You can create updates, backport fixes, etc. You can maintain that well after…
    comment by briffle · 2018-03-06 · in Google's Python Class
  44. Better to use the method demonstrated in functools' lru_cache: https://github.com/python/cpython/blob/3.6/Lib/functools.py#...
  45. …Python. At some point I somehow noticed that he wrote the Python profiler (see the name at the top https://github.com/python/cpython/blob/2.7/Lib/profile.py ). When I asked him about it he made some comment about how he didn't really know…
    comment by evmar · 2018-02-16 · in The Jim Roskind C/C++ Grammar
  46. …lot simpler. Here is the corresponding code (look above for the definition of the GETLOCAL macro): https://github.com/python/cpython/blob/fc1ce810f1da593648b4d... So your code should be more like: locals[a_idx] =…
    comment by tom_mellior · 2018-02-07 · in Python’s Weak Performance Matters
  47. It's interesting for sure, and I'd like to see where it goes, but right now there isn't much to it: https://github.com/python/cpython/blob/3.6/Lib/secrets.py
    comment by orf · 2018-02-05 · in Migrating to Python 3 with pleasure
  48. Try building one yourself ;-) https://github.com/python/cpython/releases/tag/v1.0.1
    comment by ojii · 2018-01-27 · in Python 1.0.0 is out (1994)
  49. Presumably the way to do it would be to add the individual encodings as modules in https://github.com/python/cpython/tree/master/Lib/encodings so the risk of stagnation would be low. I guess the bigger issue would be bikeshedding the names…
  50. One thing that was really educational for me was reading how CPython implemented their object system. https://github.com/python/cpython/blob/master/Include/object... Basically objects are structs that all share the same header which…