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
-
Just copy out cgi.py and use it as a module. https://github.com/python/cpython/blob/3.11/Lib/cgi.py
comment by sigzero · 2022-11-16 · in Python 3.12.0 is to remove long-deprecated items -
…you can then import. Even if they don’t, from a cursory view, it seems it’s a pure python library ( https://github.com/python/cpython/blob/main/Lib/telnetlib.py ). If so, can’t you copy the current code into your project? You would take on…
comment by Someone · 2022-11-16 · in Python 3.12.0 is to remove long-deprecated items -
…implementation in the python stdlib https://docs.python.org/3/library/difflib.html#difflib.Seque... https://github.com/python/cpython/blob/main/Lib/difflib.py
comment by _ZeD_ · 2022-11-03 · in Visualizing Diffs: The Myers difference algorithm (2020) -
▲ 2
CPython: Generate the Interpreterstory by fniephaus · 2022-11-01 · 0 comments
-
…want to await several tasks at once, so I am not sure this changes much for exception handling. * https://github.com/python/cpython/issues/90908 ** https://docs.python.org/3.11/library/asyncio-task.html#task-...
comment by nicoco · 2022-10-25 · in Python 3.11.0 final -
…This is misleading... you can use asyncio.gather which does this internally [0]. [0]: https://github.com/python/cpython/blob/main/Lib/asyncio/task...
comment by throwway2332 · 2022-10-22 · in Python and Async Simplified (2018) -
…middle (via an iterator) in O(1), so it's not a complete replacement for doubly-linked lists. [1]: https://github.com/python/cpython/blob/a4ac14faa5c2be433738d...
comment by hddqsb · 2022-09-24 · in Algorithms and data structures implemented in many programming languages -
…thread in the same interpreter though, so I still don't understand robertlagrant's question. [1]: https://github.com/python/cpython/blob/4b81139aac3fa11779f6e...
comment by remram · 2022-09-21 · in Faster CPython 3.12 Plan -
"the slow-but-simple implementation in module dbm.dumb will be used" No kidding. https://github.com/python/cpython/blob/main/Lib/dbm/dumb.py It uses a text file to store keys and pointers into a binary file for values. It works .. most of…
comment by banana_giraffe · 2022-09-15 · in TIL–Python has a built-in persistent key-value store (2018) -
FWIW, it was added in 1992. https://github.com/python/cpython/commit/dd9ed839d6958f73704... with gdbm added in 1994. https://github.com/python/cpython/commit/4b4c664d2e93279c8d7... .
comment by eesmith · 2022-09-15 · in TIL–Python has a built-in persistent key-value store (2018) -
…what you want and then try again if it’s outside your range. And indeed this is how Python does it https://github.com/python/cpython/blob/e37ac5fbb6de593521cf2... https://github.com/python/cpython/blob/e37ac5fbb6de593521cf2...
comment by Spivak · 2022-09-15 · in I figured out how to get GitHub Copilot to run in the terminal -
The ValueError in "2*2*2*2*2" is a recent change to limit denial of service attacks. See https://github.com/python/cpython/issues/95778 . In short, the value you want has 19729 digits in base-10, the conversion from the internal base-30…
comment by eesmith · 2022-09-12 · in Ask HN: Why hasn't the deep learning community embraced Julia yet? -
…algorithm exists to do otherwise." isn't true. This comment in particular is worth reading: https://github.com/python/cpython/issues/95778#issue-1331477...
comment by josephcsible · 2022-09-08 · in Int/str conversions broken in latest Python bugfix releases in all versions -
…this or done the math rigorously :) edit: this is also buried in the issue. There’s also: https://github.com/python/cpython/issues/90716 I don’t get it.
comment by amluto · 2022-09-07 · in Prevent DoS by large int-str conversions -
…there is no algorithm for this that isn't quadratic. Update: I may have understood incorrectly, see https://github.com/python/cpython/issues/90716
comment by simonw · 2022-09-07 · in Prevent DoS by large int-str conversions -
…a lot of discussion afterwards--but because the discussion was on-topic, the issue was not locked. https://github.com/python/cpython/issues/90716
comment by klodolph · 2022-09-07 · in Prevent DoS by large int-str conversions -
It looks like there is some discussion of the algorithmic options at https://github.com/python/cpython/issues/95778 https://github.com/python/cpython/issues/90716 Is there something bad going on with Python's internal representation of big…
comment by schoen · 2022-09-07 · in Prevent DoS by large int-str conversions -
…numpy test suite passes before https://github.com/numpy/numpy/issues/22098 is widely available. https://github.com/python/cpython/blob/511ca9452033ef95bc7d7...
comment by js2 · 2022-09-07 · in Prevent DoS by large int-str conversions -
https://github.com/python/cpython/issues/95778 has more information.
comment by jwilk · 2022-09-07 · in Prevent DoS by large int-str conversions -
▲ 2
CVE-2020-10735: Prevent DoS by large intstr conversionsstory by josephcsible · 2022-09-07 · 1 comment
-
▲ 146
Prevent DoS by large int-str conversionsstory by genericlemon24 · 2022-09-07 · 196 comments
-
…its native permutations function. The C source is, as always, extremely easy to understand: https://github.com/python/cpython/blob/main/Modules/itertool...
comment by qsort · 2022-08-23 · in Permutation Generation Methods [pdf] -
▲ 2
CPython PR #95908 – Add support for the BOLT post-link binary optimizerstory by susam · 2022-08-19 · 0 comments
-
I totally missed that! Thanks for the additional detail. This issue appears to have been fixed: https://github.com/python/cpython/issues/75820
comment by benji-york · 2022-08-16 · in Ask HN: Can I see your scripts? -
…before Am I missing a particular point the article is making, or did the author overlook this? [0]: https://github.com/python/cpython/blob/main/Lib/_py_abc.py
comment by w-m · 2022-08-02 · in Crimes with Python's pattern matching -
…in Python since each comparison can call a Python function) so all numbers are given as such. [1] https://github.com/python/cpython/blob/main/Objects/listsort...
comment by lifthrasiir · 2022-07-29 · in Timsort (2019) -
…ever read how time libraries are actually written? Please, go read the Python `datetime` library: https://github.com/python/cpython/blob/0fe645d6fd22a6f57e777... which is used to calculate a UTC timestamp:…
comment by lelandbatey · 2022-07-27 · in It’s time to leave the leap second in the past -
…Python ought to be portable across Python implementations. I was merely pointing out that this line https://github.com/python/cpython/blob/4395ff1e6a18fb26c7a66... isn’t exactly pure Python, because, under a different runtime (eg PyPy),…
comment by Bogdanp · 2022-07-26 · in Performance comparison: counting words in Python, C/C++, Awk, Rust, and more -
…`dict` type. I don't think it's comparable to something like using `pandas` to solve the problem. https://github.com/python/cpython/blob/main/Lib/collections/...
comment by __marvin_the__ · 2022-07-24 · in Performance comparison: counting words in Python, C/C++, Awk, Rust, and more -
…to the head. And it is in fact implemented as a doubly linked list, with various optimizations: https://github.com/python/cpython/blob/v3.8.1/Modules/_colle... .
comment by foolswisdom · 2022-07-22 · in Ask HN: What are some cool but obscure data structures you know about? -
…Documentation still hasn't been written for it yet though and that's why the issue is still open, https://github.com/python/cpython/issues/90908 .
comment by Mehdi2277 · 2022-06-27 · in What's New in Python 3.11? -
…module uses HTTP/1.1 and includes a "Connection:close" header in its HTTP requests" [1] [1] https://github.com/python/cpython/blob/3.10/Lib/urllib/reque... You seem to be correct about urllib3 and requests, I was wrong there...though they…
comment by tyingq · 2022-06-21 · in Get Paid to Contribute to Urllib3 -
…module is imported and the enable function is called. [1]: https://peps.python.org/pep-0523/ [2]: https://github.com/python/cpython/blob/main/Python/ceval.c
comment by woadwarrior01 · 2022-06-08 · in Pyston-lite: our Python JIT as an extension module -
…it's been nothing on the beta branch, I think. For example this PR is not getting merged, it seems. https://github.com/python/cpython/pull/93379
comment by kzrdude · 2022-06-06 · in Python 3.11 Performance Benchmarks Are Looking Fantastic -
…core devs. This wasn't the case, just a few years ago. [1]: https://peps.python.org/pep-0659/ [2]: https://github.com/python/cpython/blob/main/Python/ceval.c
comment by woadwarrior01 · 2022-06-06 · in Python 3.11 Performance Benchmarks Are Looking Fantastic -
The rationale was here. https://github.com/python/cpython/issues/85067#issuecomment-... It seems a bit vague: « Exposing this attribute would help with introspection, making it possible to write efficient functions that operate on dict…
comment by mjw1007 · 2022-05-21 · in Python Standard Library changes in recent years -
…here is 32 bits), which calls _Py_popcount32, which does map to a hardware instruction if possible: https://github.com/python/cpython/blob/f62ad4f2c4214fdc05cc4...
comment by orlp · 2022-05-21 · in Python Standard Library changes in recent years -
Sadly it does not call into the hardware implementation: https://github.com/python/cpython/blob/f62ad4f2c4214fdc05cc4...
comment by saagarjha · 2022-05-21 · in Python Standard Library changes in recent years -
…Sam Gross' work: https://docs.google.com/document/d/18CXhDb1ygxg-YXNBJNzfzZsD... The GIL code: https://github.com/python/cpython/blob/main/Python/ceval_gil... Py_INCREF: https://github.com/python/cpython/blob/a4460f2eb8b9db46a9bce...
comment by kortex · 2022-05-18 · in Python 3.11 beta vs. 3.10 benchmark -
The Python source - https://github.com/python/cpython/ - with full commit history back to 1990. The Unix source - https://github.com/dspinellis/unix-history-repo - with quite a number of releases dating back to 1970.
comment by eesmith · 2022-05-18 · in Ask HN: What's the oldest publicly-available repo with different versions? -
…its roots in 1998 or so. You can see how primitive testing was with this example from Python 1.3: https://github.com/python/cpython/blob/v1.3/Lib/test/test_b2... . That's actually one of the most sophisticated ones there. The test_md5…
comment by eesmith · 2022-05-12 · in I'd love a history of Python tooling -
…or thereabouts. [1] 3.7.0 is the first major release following the removal of the config option in https://github.com/python/cpython/issues/75551 .. there's also a 2021 comment about "This has unfortunately turned out to be a blocker on…
comment by fulafel · 2022-05-12 · in Python Language Summit: Python Without the GIL -
…source code links for standard library results. E.g. searching for heapq would also show a link to https://github.com/python/cpython/blob/main/Lib/heapq.py I know these links are already at the very top of most pages in the python…
comment by showmecode · 2022-05-10 · in Show HN: Pythondocs.xyz – Live search for Python documentation -
…After six years of intense bikeshedding, it was finally put in standard "datetime" in 2018. [1] https://github.com/python/cpython/issues/60077
comment by Animats · 2022-05-01 · in Rust from 0 to 80% for JavaScript Developers -
…languages with closed source development). For Python, it looks like everything is on GitHub: https://github.com/python/cpython https://github.com/python/peps It might take some exploring depending on what you are trying to find (over 100k…
comment by thesuperbigfrog · 2022-04-27 · in Ask HN: Best way to find out when features were added to languages? -
Python's main interpreter loop is a single 4k line function. https://github.com/python/cpython/blob/main/Python/ceval.c#L...
comment by rahimiali · 2022-04-03 · in A project with a single 11,000-line code file -
…STORE_FAST 0 (a) 8 STORE_FAST 1 (b) 5 10 LOAD_FAST 0 (a) 12 RETURN_VALUE Implementation of ROT_TWO https://github.com/python/cpython/blob/bc85eb7a4f16e9e2b6fb7...
comment by kmill · 2022-03-24 · in Swapping two Numbers without Temporary Variables -
…a closed connection, which the SQLite C documentation warns against. A couple of searches against https://github.com/python/cpython lead me to this code here: https://github.com/python/cpython/blob/4674fd4e938eb4a29ccd5...
comment by simonw · 2022-03-21 · in Ask HN: Codebases with great, easy to read code? -
…short Python wrapper around binascii. It's only 206 lines, much of which is comments or docstrings: https://github.com/python/cpython/blob/a5b7678a67ac99edd5082... It has three functions: one to encode, one to decode, and one to show usage…
comment by bariumbitmap · 2022-03-18 · in PEP 594 – Removing dead batteries from the standard library -
…[1]. To be honest, I was really surprised how needlessly complex that particular code is. [1] - https://github.com/python/cpython/blob/main/Lib/argparse.py
comment by genmud · 2022-03-18 · in Python finally offloads some batteries