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. …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?
  2. …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
  3. …[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
  4. …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
  5. …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
  6. https://github.com/python/cpython/blob/v3.6.2/Lib/collection...
    comment by jwilk · 2017-08-30 · in Reducing Python's startup time
  7. …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
  8. …the GIL for the time of the compression (though it locks the compressor object simultaneously): https://github.com/python/cpython/blob/d4b93e21c2664d6a78e06...
  9. 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
  10. https://github.com/python/cpython/blob/5d75f441ef0a3cfe7af0d...
    comment by andars · 2017-07-22 · in Converting floats to strings
  11. …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
  12. …like in C). In case anyone cares how Python actually does in in C, for small ints its defined at https://github.com/python/cpython/blob/master/Objects/longob...
    comment by kmill · 2017-07-04 · in Block-breaking game in vim 8.0
  13. Python has migrated from hg to git. The current version of tupleobject.c is here: https://github.com/python/cpython/blob/master/Objects/tupleo...
    comment by jwilk · 2017-06-26 · in Diving into the world of hash tables
  14. …of locals use an internal array of local variables, to skip dicts. Same with constants. See: https://github.com/python/cpython/blob/master/Python/ceval.c...
    comment by adrian17 · 2017-06-26 · in Diving into the world of hash tables
  15. …typed "python" and got no results, which seems pretty odd.) I would have liked to browse this repo: https://github.com/python/cpython I guess you have to import repositories yourself? There seem to be sample repositories, but they are in…
  16. …awesome! I didn't know that too. It's pretty cool. Seems like they overload __truediv__ operator: https://github.com/python/cpython/blob/master/Lib/pathlib.py...
  17. Relevant: https://github.com/python/cpython/commit/30d00e54dde47b11f5b...
  18. …for comparing integers. ;) [0] http://doc.pypy.org/en/latest/cpython_differences.html#objec... [1] https://github.com/python/cpython/blob/master/Objects/longob... [2] https://github.com/python/cpython/blob/ba85d69a3e3610bdd05f0...
    comment by squeaky-clean · 2017-05-25 · in Show HN: 15-question programming quiz with answers
  19. 0-256 not sure about negatives -5 to 256 (inclusive) [ https://github.com/python/cpython/blob/master/Objects/longob... ]
  20. 0 to 256 if I recall right -5 to 256 (inclusive) [ https://github.com/python/cpython/blob/master/Objects/longob... ]
  21. That was apparently fixed in Python 2.7: https://github.com/python/cpython/commit/6116d4a1d1ecd6e9b94... http://bugs.python.org/issue12099 But that commit pre-dates the blog post by many years, so maybe Armin was referring to something…
  22. …where classes make sense in standard libraries would be (impure) interfaces such as csv.Dialect ( https://github.com/python/cpython/blob/6aee6fb/Lib/csv.py#L2... ) An example of where inherited classes make sense in abstraction would be…
  23. I just saw that Python's Makefile has support for PGO builds: https://github.com/python/cpython/blob/master/Makefile.pre.i... Not sure when it was added, but Python 2.7 has it. It's not clear to me how to tell if say my Ubuntu binary is…
  24. …python-git instead of the main Python repo. The whole project has been moved as of a couple months. https://github.com/python/cpython
  25. …old version of Python source from a mirror. It uses functools.lru_cache with a maxsize of 256 now: https://github.com/python/cpython/blob/fcfe80ec2592fed8b3941...
    comment by benhoyt · 2017-04-24 · in Glob Matching Can Be Simple and Fast Too
  26. …(in stdlibc it's just a double pointer to T IIRC). In Python it's a doubly-linked list of blocks: https://github.com/python/cpython/blob/master/Modules/_colle...
  27. The only codebase I've checked personally can't handle Y10K, so there should be plenty of business: https://github.com/python/cpython/blob/6f0eb93183519024cb360...
    comment by elevensies · 2017-03-21 · in 2038: Only 21 years away
  28. …things. I'm totally sure now. Guido's last commit, in both the github repo and the mercurial repo. https://github.com/python/cpython/commit/934aba66ef09e94422b... https://hg.python.org/cpython/rev/3db1959c2c53 Someone sensible may be able…
    comment by harry8 · 2017-02-13 · in Python moved to GitHub
  29. …into a native environment block and gives it as the envp pointer to the exec/spawn functions. [1]: https://github.com/python/cpython/blob/a65137dc41fb52bdb1ca2... [2]: https://github.com/python/cpython/blob/a65137dc41fb52bdb1ca2... [3]:…
  30. …python source code[1] implementation of the Environment class, I think python is also affected. 1. https://github.com/python/cpython/blob/master/Lib/os.py#L664
    comment by RabbitmqGuy · 2017-01-31 · in Don't setenv in multi-threaded code on glibc
  31. The decimal module in Python 2.7 is implemented in pure Python: https://github.com/python/cpython/blob/2.7/Lib/decimal.py (in Python 3 there is an accelerated extension module that's used when available, falling back on the pure Python…
    comment by brettcannon · 2017-01-04 · in Grumpy: Go running Python
  32. Brett, thanks for contributions to Python. (... and thanks to the other contributors, https://github.com/python/cpython/blob/master/Misc/ACKS , and to all people who volunteer their by contributing to open source...) I am another silent…
    comment by jamesdutc · 2016-12-21 · in Taking a month off from OSS volunteering
  33. I doubt that because defining a namedtuple just creates a new class internally: https://github.com/python/cpython/blob/master/Lib/collection... Class creation the very expensive in Python, so Guido van Rossum explicitly recommends against…
    comment by skrause · 2016-12-08 · in What’s New In Python 3.6
  34. …can robustly parse many different dialects of CSV is quite a challenge. Have a read of Python's: https://github.com/python/cpython/blob/master/Lib/csv.py EDIT: It's probably not fair to say that nobody actually uses the RFC 4180 version of…
  35. What about the code for this python regular expression engine that is filled with goto statements? https://github.com/python/cpython/blob/master/Modules/sre_li... Or the code for the OpenSSL handshake that interleaves preprocessing…
  36. …using str.split(',') which is completely different than Python's offering of dialect/delimiter/etc https://github.com/python/cpython/blob/master/Lib/csv.py#L24
  37. …helps. In Python, a list object over-allocates using a very peculiar, but finely tuned formula: https://github.com/python/cpython/blob/09dc3ec1713c677f71ba7...
    comment by justusw · 2016-08-23 · in When Big O Fools You
  38. …for example uses os.urandom for random UUID generation (uuid4), as can be seen in the source: https://github.com/python/cpython/blob/3.5/Lib/uuid.py#L603 The standard library guarantees that os.urandom is "[...] suitable for cryptographic…
    comment by justusw · 2016-08-20 · in How Long Should I Make My API Key?
  39. …grammar as specified in the file called Grammar in the canonical implementation of the language ( https://github.com/python/cpython/blob/master/Grammar/Gramma... ). Of course it's part of the grammar in the larger sense. I don't think that…
    comment by gary_bernhardt · 2016-08-08 · in Destroy All Software relaunches
  40. …those three problems and you didn't. I trust this reply will alleviate the misconception. [0]: https://github.com/python/cpython/blob/master/Objects/dictob... [1]: https://github.com/python/cpython/blob/master/Objects/dictob...
    comment by jsmthrowaway · 2016-07-14 · in Asciinema 1.3 Switches from Go Back to Python
  41. …hard way. For the curious, read through the comment here describing the data layout and invariants: https://github.com/python/cpython/blob/master/Include/unicod...
    comment by int_19h · 2016-06-20 · in UTF-8 Everywhere (2012)
  42. If you are lexing there is a much better way than trying to munge together a giant regex manually: https://github.com/python/cpython/blob/3.4/Lib/re.py#L346
    comment by justin_vanw · 2016-02-20 · in Python 3.4 supports only 100 regex groups
  43. https://github.com/python/cpython/commit/33455fe85760e0173ee...
  44. I guess you meant Python 3.4 because 3.5 has no limitation: https://github.com/python/cpython/blob/3.5/Lib/sre_compile.p...
    comment by namtrac · 2016-02-20 · in Python 3.4 supports only 100 regex groups
  45. …handler before you restart the syscal on EINTR in C code. Look at how os.waitpid() is implemented: https://github.com/python/cpython/blob/master/Modules/posixm...
    comment by d0mine · 2016-02-09 · in Writing my own init with Go
  46. …This does not exist in Python 3[2] (and therefore neither does the performance difference). [1] https://github.com/python/cpython/blob/2.7/Python/ceval.c#L1... [2] https://github.com/python/cpython/blob/master/Python/ceval.c...
  47. …something like namedtuple there are other[2] things[3] you can use depending on your use-case. [1] https://github.com/python/cpython/blob/master/Lib/collection... [2] http://stackoverflow.com/a/2648186 [3]…
  48. …of just how easy CPython's implementation is to read in many cases. [1]: see this, for example: https://github.com/python/cpython/blob/0eb5f5996feed30ade8c2... [2]: https://github.com/python/cpython/blob/0eb5f5996feed30ade8c2... [3]:…
    comment by deathanatos · 2016-01-14 · in Complexity of Python Operations (2013)
  49. …so far the only git presence of Python was a "semi-official readonly mirror" on github: https://github.com/python/cpython now does this mean that Python will completely switch away from Mercurial? this was one of the major projects still…
    comment by anarcat · 2016-01-01 · in Python moves to GitHub
  50. Indeed, the Python 3 Unicode string object is fascinatingly clever. Code worth reading: https://github.com/python/cpython/blob/master/Objects/unicod...
    comment by twoodfin · 2015-12-17 · in Why Python 3 Exists