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. …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)
  2. Especially when you start looking at the code for some of these https://github.com/python/cpython/blob/master/Lib/imghdr.py
  3. …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
  4. https://github.com/python/cpython/search?utf8=%E2%9C%93&q=kl...
    comment by qwsxyh · 2019-04-19 · in Interface Dispatch (2018)
  5. …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
  6. …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
  7. …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...
  8. …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...
  9. itemgetter and attrgetter are compiled C functions called by cpython https://github.com/python/cpython/blob/master/Modules/_opera...
  10. …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…
  11. …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…
  12. …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
  13. ….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
  14. 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
  15. ▲ 2
    Ask HN: Blocking os.urandom calls in Python = 3.6
    story by jbaviat · 2018-11-19 · 4 comments
  16. …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
  17. …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…
  18. …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…
  19. …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…
  20. …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
  21. 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
  22. 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
  23. ▲ 38
    How PEP-572 would change the standard library
    story by rbanffy · 2018-07-06 · 65 comments
  24. Python is using Git these days: https://github.com/python/cpython/blob/master/Objects/listob...
  25. …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
  26. …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
  27. 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
  28. 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
  29. …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…
  30. …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…
  31. …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
  32. Better to use the method demonstrated in functools' lru_cache: https://github.com/python/cpython/blob/3.6/Lib/functools.py#...
  33. …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
  34. …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
  35. 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
  36. 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)
  37. 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…
  38. ▲ 1
    CPython GIL Implementation
    story by marviel · 2017-11-27 · 0 comments
  39. 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…
  40. …will be always wrong except in the uncommon case of a sequence of several identical opcodes). [1] https://github.com/python/cpython/blob/ff8ad0a576c6cf375e682...
    comment by vilda · 2017-10-04 · in Are Jump Tables Always Fastest?
  41. …you can + on BUT strings [0], this is to avoid quadratic behavior with string concatenation. [0] https://github.com/python/cpython/blob/5837d0418f47933b2e3c1...
    comment by Franciscouzo · 2017-09-30 · in Haskell People
  42. …[2] https://kbknapp.github.io/clap-rs/unicode_segmentation/index... [3] https://github.com/python/cpython/blob/49b2734bf12dc1cda80fd...
    comment by masklinn · 2017-09-07 · in How Python does Unicode
  43. …examples you gave are examples of that good use. The time.localtime() used to return a tuple. See https://github.com/python/cpython/blob/770e4042db8a1c277b5d9... . The change to StructTimeType is an example of how to do that sort of…
    comment by eesmith · 2017-08-30 · in Reducing Python's startup time
  44. …deeply first. For the specific case under discussion, ncoghlan added cache_info() on 30 Nov 2010 - https://github.com/python/cpython/commit/234515afe594e5f9ca1... Previously, "Performance statistics stored in f.cache_hits and…
    comment by eesmith · 2017-08-30 · in Reducing Python's startup time
  45. https://github.com/python/cpython/blob/v3.6.2/Lib/collection...
    comment by jwilk · 2017-08-30 · in Reducing Python's startup time
  46. …git archaeology. Here are relevant commits and bug reports: * Initial commit with -1...99 cached: https://github.com/python/cpython/commit/842d2ccdcd540399501... * Cache more negative numbers, -5...99:…
    comment by jwilk · 2017-08-24 · in Weird Python Integers
  47. …the GIL for the time of the compression (though it locks the compressor object simultaneously): https://github.com/python/cpython/blob/d4b93e21c2664d6a78e06...
  48. Argparse's source is possibly the most difficult lib to grow from the stdlib. https://github.com/python/cpython/blob/master/Lib/argparse.p... For me, it is not debugable. I wanted to propose and start a reference implementation for…
    comment by yes_or_gnome · 2017-07-28 · in Python Entry Points Explained
  49. https://github.com/python/cpython/blob/5d75f441ef0a3cfe7af0d...
    comment by andars · 2017-07-22 · in Converting floats to strings
  50. …but it also doesn't appear to limit itself to C89, see for instance this random file I opened: https://github.com/python/cpython/blob/master/Python/future.... You can see that `const char *feature` is declared in the middle of some code.…
    comment by simias · 2017-07-13 · in Toward Go 2