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
20082026
-
…the last month and a few more in flight. I.e the project has already started. See for example https://github.com/python/cpython/pull/25152
comment by kzrdude · 2021-05-13 · in Faster CPython Ideas – Issue Tracker for Faster CPython Project -
Why isn't this hosted at https://github.com/python/cpython/issues ?
comment by etskinner · 2021-05-13 · in Faster CPython Ideas – Issue Tracker for Faster CPython Project -
This project has already submitted a few small changes into cpython, like https://github.com/python/cpython/pull/25069 and https://github.com/python/cpython/pull/25729
comment by kzrdude · 2021-05-13 · in Faster CPython Ideas – Issue Tracker for Faster CPython Project -
…notes (alongside an explicit statement that it would become default four years later in 3.10): https://github.com/python/cpython/blob/a41782cc84bcd813209a0...
comment by williamsmj · 2021-04-16 · in PEP 563, PEP 649 and the future of pydantic and FastAPI -
…and it's already no small feat to have added them without breaking backwards compatibility. [0] https://github.com/python/cpython/blob/8a232c7b17a2e41ae14d8...
comment by guitarbill · 2021-04-16 · in PEP 563, PEP 649 and the future of pydantic and FastAPI -
…cannot assign to literal [0]: https://docs.python.org/3/library/stdtypes.html#float.fromhe... [1]: https://github.com/python/cpython/blob/5ce227f3a767e6e44e7c4... [2]: https://github.com/python/cpython/blob/5ce227f3a767e6e44e7c4...
comment by css · 2021-04-13 · in In Python, `[0xfor x in (1, 2, 3)]` returns `[15]` -
…It doesn't, since 3.8. It tries fcopyfile() and only if it fails, does the read/write dance. See: https://github.com/python/cpython/blob/master/Lib/shutil.py#...
comment by vetinari · 2021-04-08 · in Surprisingly Slow -
https://github.com/python/cpython/blob/master/Objects/dictob...
comment by knome · 2021-03-26 · in How to implement a hash table in C -
…an attribute that begins with assert Or any of the names in this surprising hardcoded list of typos https://github.com/python/cpython/blob/fdb9efce6ac211f973088...
comment by progval · 2021-03-25 · in My Python testing style guide (2017) -
…Python 3.x being slower than 2.x. [0] https://rubykaigi.org/2016/presentations/tanaka_akr.html [1] https://github.com/python/cpython/blob/8d21aa21f2cbc6d50aab3... [2] https://github.com/python/cpython/blob/39f643614d03748a5fad4...
comment by pansa2 · 2021-03-24 · in Donald Knuth’s Algorithm D, its implementation in Hacker’s Delight and elsewhere -
…pass Here is the C version (with a comment a little way down describing the "fast path advantages": https://github.com/python/cpython/blob/93d33b47af70ede473f82...
comment by benhoyt · 2021-03-15 · in Performance comparison: counting words in Python, Go, C++, C, Awk, Forth, Rust -
…Counter.update instead because I thought linking to the call site is clearer), but here it is: https://github.com/python/cpython/blob/2fe408497e6838b6fb761... Again, very straightforward, based on dict. Python itself does not function at…
comment by oefrha · 2021-03-15 · in Performance comparison: counting words in Python, Go, C++, C, Awk, Forth, Rust -
…amount of) overhead. Now, dict is optimized, but that's a builtin type. You don't need PSL. https://github.com/python/cpython/blob/2fe408497e6838b6fb761...
comment by oefrha · 2021-03-15 · in Performance comparison: counting words in Python, Go, C++, C, Awk, Forth, Rust -
…as a performance optimization. Type-specific free lists (just a few examples; there are more): * https://github.com/python/cpython/blob/master/Objects/floato... * https://github.com/python/cpython/blob/master/Objects/tupleo... And also…
comment by loeg · 2021-03-13 · in Speed of Rust vs. C -
Thank you for the pointer. Seems they have already fixed it. https://github.com/python/cpython/pull/24721/files
comment by kamyarg · 2021-03-03 · in Python 3.10.0a6 is available, now with 100% more pattern matching -
There's a "Show Source" link in the navigation that points to https://github.com/python/cpython/blob/master/Doc/whatsnew/3...
comment by ktpsns · 2021-03-03 · in Python 3.10.0a6 is available, now with 100% more pattern matching -
It's not that powerful, if I'm reading it correctly: https://github.com/python/cpython/commit/34df10a9a16b38d5442... The sprintf is to a temporary buffer that's converted to a PyUnicode object before returning, so subsequent portions of…
comment by duckerude · 2021-02-19 · in Python 3.x: RCE in Python applications that accept floats as untrusted input -
…repr'd, an sprintf call with a statically sized buffer of 256 bytes is used to produce a string: https://github.com/python/cpython/commit/d9b8f138b7df3b455b54653ca59f491b4840d6fa#diff-4e23b3237d0aa08bf4c434d75fab19200a80837bd147051fefccd98b…
comment by dividuum · 2021-02-18 · in Python 3.x: RCE in Python applications that accept floats as untrusted input -
▲ 3
A great optimization for CPython with great benchmarking resultsstory by androdiscens · 2021-02-15 · 1 comment
-
For reference, here is the live copy of longobject.c: https://github.com/python/cpython/blob/master/Objects/longob... Python 2 had distinct `int` and `long` types, but Python 3 merged them together into just `int`. I wasn't sure if the…
comment by nayuki · 2021-02-15 · in Python Internals Serie: Int (Long) Object -
https://github.com/python/cpython/commit/b71c7dc9ddd6997be49... commit b71c7dc9ddd6997be49ed6aaabf99a067e2c0388 Author: Victor Stinner <victor.stinner@gmail.com> Date: Fri Oct 10 11:55:41 2014 +0200 Issue #22591: Drop support of MS-DOS…
comment by eesmith · 2021-01-24 · in Pip has dropped support for Python 2 -
…treated as a format string _if_ there are arguments. If not, it is treated as a literal string: https://github.com/python/cpython/blob/dcea78ff53d02733ac598...
comment by dagenix · 2021-01-21 · in Python 3's F-Strings: An Improved String Formatting Syntax -
PyCon totally does affect python.tar.gz. https://github.com/python/cpython/pulls?q=+label%3Asprint (and that link doesn’t capture the PEPs hashed out among other things.) Also, why the hell make a new account for each comment?
comment by oefrha · 2020-12-31 · in PyPy Project looking for sponsorship to add support for Apple Silicon -
…for macOS 11 and Apple Silicon count? Here's a list of Apple-submitted PRs on python/cpython: https://github.com/python/cpython/pulls?q=is%3Apr+author%3Al... Also some co-authored patches excluded by the search. See…
comment by oefrha · 2020-12-31 · in PyPy Project looking for sponsorship to add support for Apple Silicon -
…is part of the standard library, and was part of the standard library in 3.0, and contained reduce: https://github.com/python/cpython/blob/3.0/Lib/functools.py#... What he meant to say is that it's removed from the list of builtins.
comment by geofft · 2020-12-25 · in In CPython, types implemented in C are part of the type tree -
Python's developers must have enormous heads if that's the case: https://github.com/python/cpython/blob/b8fde8b5418b75d2935d0...
comment by brobinson · 2020-12-21 · in Write code. Not too much. Mostly functions. -
There are fast-paths for these cases, like this one: https://github.com/python/cpython/blob/4b8cdfcb22fbeaab9d954... (and note the comment above it about integer addition!) But the cpython folk make understandability an explicit goal of…
comment by ketralnis · 2020-12-11 · in How the Python object system works -
Thanks. So it seems both were updated with 'key' at the same time: https://github.com/python/cpython/commit/871934d4cf00687b3d1... Now I'm wondering - what is the point of the python version, if it will always be overridden by the C…
comment by rahimnathwani · 2020-11-23 · in Using Python's Bisect Module -
…is in Modules/_bisectmodule.c, whereas the Python version is in Lib/bisect.py. Python version: https://github.com/python/cpython/blob/master/Lib/bisect.py C version: https://github.com/python/cpython/blob/master/Modules/_bisec...
comment by kaunta · 2020-11-22 · in Using Python's Bisect Module -
https://github.com/python/cpython/blob/master/Lib/bisect.py
comment by rahimnathwani · 2020-11-22 · in Using Python's Bisect Module -
…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...
comment by coderzach · 2020-11-15 · in Packrat Parsing: Simple, Powerful, Lazy, Linear Time [pdf] -
…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
comment by woadwarrior01 · 2020-11-15 · in Pydis – Redis clone in 250 lines of Python, for performance comparison -
…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…
comment by Groxx · 2020-11-10 · in On the Beauty of Python's ExitStack (2015) -
…[2]: https://repl.it/@Groxx/TepidRosybrownLocatorprogram#main.py [3]: https://github.com/python/cpython/blob/master/Lib/contextlib...
comment by Groxx · 2020-11-10 · in On the Beauty of Python's ExitStack (2015) -
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 -
Direct threading is in here https://github.com/python/cpython/blob/0564aafb71a153dd0aca4...
comment by jashmatthews · 2020-10-28 · in Pyston v2: Faster Python -
…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 -
…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...
comment by oefrha · 2020-10-20 · in PyInstrument – A statistical Python profile that focuses on the slow parts -
…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 -
…'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 -
…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 -
…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 -
…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 -
…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…
comment by BiteCode_dev · 2020-09-07 · in Fastcore: A library that extends Python with new features -
…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…
comment by wrmsr · 2020-09-05 · in Fastcore: A library that extends Python with new features -
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...
comment by viraptor · 2020-08-23 · in Python Hash Tables: understanding dictionaries -
…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…
comment by price · 2020-08-17 · in In the Turkish locale, "INFO".lower() != "info" -
▲ 188
In the Turkish locale, "INFO".lower() != "info"story by duckerude · 2020-08-16 · 282 comments
-
…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 -
…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...
comment by Znafon · 2020-08-14 · in Django Async: What's new and what's next?