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. …Proposal to use PEG parser in python https://www.python.org/dev/peps/pep-0617/ Python PEG grammar https://github.com/python/cpython/blob/3.9/Grammar/python.gr...
  2. …of its hash table implementation that it has been optimized over and over decades now. [1]: https://github.com/python/cpython/blob/master/Objects/dictob... [2]: https://github.com/redis/redis/blob/unstable/src/dict.c
  3. …and it'll yield values (not hard to do with a recursive one, I just didn't feel like it): https://github.com/python/cpython/blob/2.7/Lib/contextlib.py... Seems like the __new__/__init__ issues exist with ExitStack as well, unlike with…
  4. …[2]: https://repl.it/@Groxx/TepidRosybrownLocatorprogram#main.py [3]: https://github.com/python/cpython/blob/master/Lib/contextlib...
  5. In fact, that's exactly how Python implements UNARY_NEGATIVE: https://github.com/python/cpython/blob/v3.9.0/Python/ceval.c... If you look a bit further down in the original article, you'll see that the BINARY_ADD instruction does something…
    comment by teraflop · 2020-11-09 · in How Python bytecode is executed
  6. Direct threading is in here https://github.com/python/cpython/blob/0564aafb71a153dd0aca4...
    comment by jashmatthews · 2020-10-28 · in Pyston v2: Faster Python
  7. …based interpreter it was 20 years ago. no threading, no super instructions, no jitting, nothing. https://github.com/python/cpython/blob/master/Python/ceval.c...
    comment by toolslive · 2020-10-28 · in Pyston v2: Faster Python
  8. …unless you supply your own timer, and time.perf_counter does measure wall clock time. See https://github.com/python/cpython/blob/ec42789e6e14f6b6ac135... https://docs.python.org/3/library/time.html#time.perf_counte...
  9. …for release in December. Details available here: https://pybind11.readthedocs.io/en/latest and https://github.com/python/cpython/pull/22670 .
    comment by wjakob · 2020-10-20 · in Python 3.9
  10. …'b']) where the namedtuple function actually has to hack around the fact that it's not a macro : https://github.com/python/cpython/blob/644e94272a89196801825... tldr: Foo needs to have __module__ = 'yourmodule' __qualname__ =…
    comment by uryga · 2020-10-15 · in PEP 638 – Syntactic Macros
  11. …with a finite maxsize. Implementation-wise it's identical to using maxsize=None. See source: https://github.com/python/cpython/blob/3.9/Lib/functools.py#...
    comment by uyt · 2020-10-05 · in Python 3.9
  12. …including CPython, use computed gotos for a not insignificant performance improvement. https://github.com/python/cpython/blob/master/Python/ceval.c...
    comment by Jasper_ · 2020-09-24 · in How the CPython compiler works
  13. …can be found in ceval.c. There is a big switch case for each python bytecode opcode starting at https://github.com/python/cpython/blob/master/Python/ceval.c... One can see even the simplest operations call quite a lot of stuff. I gave up…
    comment by xaedes · 2020-09-24 · in How the CPython compiler works
  14. …as I can tell functools.partial has been implemented in C since it was added sixteen years ago ( https://github.com/python/cpython/commit/9c323f8de4910dfc0ba... . ), and it's faster than lambda ( https://gist.github.com/wrmsr/1e13eda3ed7828…
  15. …as I can tell functools.partial has been implemented in C since it was added sixteen years ago ( https://github.com/python/cpython/commit/9c323f8de4910dfc0ba... ), and it's faster than lambda ( https://gist.github.com/wrmsr/1e13eda3ed782886…
  16. In case anyone is curious, sets were dicts in the original implementation: https://github.com/python/cpython/blob/a690a9967e715663b7a42... It was changed in 2005 for python 2.5 https://github.com/python/cpython/commit/9f1a6796eb83a2884df...
  17. …digging through history, it looks like the change in behavior for byte strings was intentional: https://github.com/python/cpython/commit/6ccd3f2dbcb98b33a71... Author: Guido van Rossum <guido@python.org> Date: Tue Oct 9 03:46:30 2007 +0000…
  18. …of real-life VMs. Even VMs which do interpret don’t do the way written in the article, take a look: https://github.com/python/cpython/blob/v3.9.0rc1/Python/ceva... What exactly it is you’re learning then?
    comment by Const-me · 2020-08-15 · in Write Your Own Virtual Machine
  19. …or IO bound tasks in Python, for example when reading from a socket the GIL gets released at https://github.com/python/cpython/blob/e822e37946f27c09953bb...
  20. …return. The C tuple packing function cannot return directly from the Python function. Looking at https://github.com/python/cpython/blob/master/Python/ceval.c , here is the code that needs to be executed after the tuple is constructed: case…
  21. …does not mean adding pipes and arguments. This is one important benefit of not using shell. See https://github.com/python/cpython/blob/master/Lib/webbrowser...
    comment by Too · 2020-07-14 · in Hacking with environment variables
  22. …and nowadays, it almost is. This is the only part left that uses it, to create the constructor: https://github.com/python/cpython/blob/master/Lib/collection... Even there it's not strictly necessary. You could accomplish the same thing…
  23. …as the first operation, not knowing whether it received an iterator or some other kind of iterable. https://github.com/python/cpython/blob/384621c42f9102e31ba2c... If you search for `list` in the CPython code, you'll find many examples of…
  24. If you want to follow along in the Python source code, the relevant file is https://github.com/python/cpython/blob/master/Python/ceval.c . The interpreter is a loop over a big switch statement on the byte codes. Most operations are pretty…
    comment by tom_mellior · 2020-06-24 · in The PVM – Python Virtual Machine
  25. …[2], so aren't such a special case anymore. [1] https://www.python.org/dev/peps/pep-0530/ [2] https://github.com/python/cpython/pull/20370 , https://github.com/python/cpython/pull/20370/files
  26. …of the Python project, called distutils.dist.Distribution which has a function named is_pure(): https://github.com/python/cpython/blob/e42b705188271da108de4... Which makes sure that it doesn't have any known external modules or c…
    comment by X-Istence · 2020-06-21 · in Python Wheels Crosses 90%
  27. …[2]: https://www.programminglogic.com/example-of-client-server-pr... [3]: https://github.com/python/cpython/blob/3.8/Lib/asyncio/unix_...
    comment by ben509 · 2020-06-14 · in Async Python is not faster
  28. …which is ~1500 LOC [2]. I guess parsing CSVs reliably is a reasonably difficult undertaking. [1] https://github.com/python/cpython/blob/3.8/Lib/csv.py [2] https://github.com/python/cpython/blob/4a21e57fe55076c77b0ee...
  29. One obvious use case invoked all the time: tracebacks are generated through introspection. https://github.com/python/cpython/blob/3.8/Lib/traceback.py
  30. …). It is Turing complete. See source code and documentation at https://github.com/python/cpython/blob/master/Lib/pickle.py#... https://github.com/python/cpython/blob/master/Lib/pickletool... N.B: "Turing complete" really
    comment by bugmen0t · 2020-04-24 · in Accidentally Turing-Complete
  31. As far as I can see this should be the list of changes: https://github.com/python/cpython/blob/v2.7.18/Misc/NEWS.d/2...
  32. If you're interested in what actually changed in this update, the release notes are here: https://github.com/python/cpython/blob/2.7/Misc/NEWS.d/2.7.1...
  33. They stopped making changes on January 1st 2020 https://github.com/python/cpython/commits/2.7 This is the release of the changes up to that date, since they don't release instantly.
  34. …implemented in this way. A concrete example would be Python's PyObject which share PyObject_HEAD. https://github.com/python/cpython/blob/master/Include/object...
  35. …earlier comment I was responding to mentioned only Python, not Go. And Python suppresses SIGPIPE: https://github.com/python/cpython/blob/master/Python/pylifec... , https://github.com/python/cpython/blob/master/Doc/library/si... > Does the…
    comment by loeg · 2020-03-22 · in How do Unix pipes work?
  36. This was definitely not accidental. Here is the commit that introduces `all` and `any`: https://github.com/python/cpython/commit/96229b19181 It includes a test for the empty case: `self.assertEqual(all([]), True)`. They knew what they were…
  37. …definition. def all(iterable): for element in iterable: if not element: return False return True https://github.com/python/cpython/blob/master/Python/bltinmo...
  38. eval(/exec) is how dataclasses (and namedtuples before them) work: https://github.com/python/cpython/blob/4c1b6a6f4fc46add0097e... . It is a big gun, but sometimes (usually deep within lib code) big guns are the right answer. Don't use…
    comment by wrmsr · 2020-02-17 · in Overload functions in Python
  39. I _think_ this may be the implementation: https://github.com/python/cpython/blob/60ac6ed5579f6666130fc... There are copious notes in there about the implementation and it indicates linked lists are used. EDIT: Blargh, it's here:…
    comment by Rapzid · 2020-02-08 · in Python dicts are now ordered
  40. Don't think so; at least on Windows it uses the optimal QueryPerformanceCounter API. https://github.com/python/cpython/blob/master/Python/pytime....
  41. It seems to be enabled by default since 2013/Python 3.4: https://bugs.python.org/issue5845 https://github.com/python/cpython/commit/1a6cb30a346ba8812d6... https://docs.python.org/3.4/whatsnew/3.4.html#sys Support already existed in Python…
    comment by duckerude · 2020-01-16 · in Autocomplete as an Interface (2015)
  42. …conditioned on the fd being 31. From that breakpoint I did a Python backtrace (using the tools from https://github.com/python/cpython/blob/master/Misc/gdbinit ) to figure out the Python code that was responsible for the allocation. The…
    comment by nneonneo · 2020-01-13 · in Bug #915: Please help
  43. It's still like that in CPython: https://github.com/python/cpython/blob/master/Lib/tempfile.p... If there's a strong enough case that this is broken (and the KeyboardInterrupt example is a good one), I think we should file a bug about it.…
    comment by nneonneo · 2020-01-13 · in Bug #915: Please help
  44. …- it really shouldn't... My guess is the tempfile is leaking due to the attribute caching here https://github.com/python/cpython/blob/master/Lib/tempfile.p... . But that doesn't really explain why the file is getting closed twice.…
    comment by asdfaoeu · 2020-01-13 · in Bug #915: Please help
  45. …libuv, like Node - is apparently the fastest asyncio event loop. CPython Asyncio C module source: https://github.com/python/cpython/blob/master/Modules/_async... Asyncio docs: https://docs.python.org/3/library/asyncio.html (When things…
    comment by westurner · 2019-12-25 · in Ask HN: Is it worth it to learn C in 2020?
  46. …and cite to a follow up spec addressing a bug in the initial treatment of negative timezones... https://github.com/python/cpython/blob/master/Lib/email/_par...
  47. …uses of Ellipsis are actually special-cased; it is not a standard part of the abstract syntax. [0] https://github.com/python/cpython/blob/master/Parser/Python....
    comment by lidHanteyk · 2019-12-17 · in A tiny Python exception oddity
  48. …the venv module added in 3.3 gets the job done. And that does default to symlinks for posix. https://github.com/python/cpython/blob/3.8/Lib/venv/__init__...
  49. Python uses a String conversion to implement rounding, so why not? :) https://github.com/python/cpython/blob/master/Objects/floato...
  50. Funny fact: the python round implementation actually uses strings. https://github.com/python/cpython/blob/master/Objects/floato...