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. …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…
  2. …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
  3. …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…
  4. …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…
  5. 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
  6. …[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
  7. …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%
  8. …[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
  9. …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...
  10. One obvious use case invoked all the time: tracebacks are generated through introspection. https://github.com/python/cpython/blob/3.8/Lib/traceback.py
  11. …). 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
  12. 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...
  13. 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...
  14. 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.
  15. …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...
  16. …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?
  17. 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…
  18. …definition. def all(iterable): for element in iterable: if not element: return False return True https://github.com/python/cpython/blob/master/Python/bltinmo...
  19. ▲ 143
    Dictionary union (PEP 584) is merged
    story by whalesalad · 2020-02-25 · 84 comments
  20. 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
  21. 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
  22. Don't think so; at least on Windows it uses the optimal QueryPerformanceCounter API. https://github.com/python/cpython/blob/master/Python/pytime....
  23. 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)
  24. …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
  25. 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
  26. …- 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
  27. …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?
  28. …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...
  29. …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
  30. …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__...
  31. ▲ 10
    Python 3.9 Alpha 1 released
    story by gonational · 2019-11-20 · 3 comments
  32. Python uses a String conversion to implement rounding, so why not? :) https://github.com/python/cpython/blob/master/Objects/floato...
  33. Funny fact: the python round implementation actually uses strings. https://github.com/python/cpython/blob/master/Objects/floato...
  34. 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
  35. …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…
  36. 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... .
  37. …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++
  38. …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)
  39. …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
  40. …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
  41. …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
  42. …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
  43. ▲ 268
    Python rounds float values by converting them to string and then back
    story by bishala · 2019-08-28 · 144 comments
  44. …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
  45. ▲ 1
    Cpython List Object Implementation
    story by davidjnelson · 2019-07-30 · 0 comments
  46. …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
  47. [-5, 256]: https://github.com/python/cpython/blob/master/Objects/longob...
  48. …) Reading the source of your favorite interpreted programming language can be rewarded, e.g. https://github.com/python/cpython
  49. …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]…
  50. ▲ 3
    Zen of Python (import this) message encrypted with ROT13
    story by tandav · 2019-06-09 · 0 comments