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
-
…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 -
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 -
…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 -
…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…
comment by chubot · 2017-06-22 · in Show HN: Sourcetrail – Get productive on unfamiliar source code -
…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...
comment by rajathagasthya · 2017-06-14 · in New features you can't use unless you are in Python 3 -
Relevant: https://github.com/python/cpython/commit/30d00e54dde47b11f5b...
comment by sprt · 2017-06-01 · in Hunting Performance in Python Code: Measuring Memory Consumption -
…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 -
0-256 not sure about negatives -5 to 256 (inclusive) [ https://github.com/python/cpython/blob/master/Objects/longob... ]
comment by bakery2k · 2017-05-24 · in Show HN: 15-question programming quiz with answers -
0 to 256 if I recall right -5 to 256 (inclusive) [ https://github.com/python/cpython/blob/master/Objects/longob... ]
comment by bakery2k · 2017-05-24 · in Show HN: 15-question programming quiz with answers -
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…
comment by js2 · 2017-05-23 · in Python's Hidden Regular Expression Gems (2015) -
…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…
comment by tony · 2017-05-13 · in Ask HN: How often do you use inheritance? -
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…
comment by chubot · 2017-05-02 · in Kotlin doesn’t need an LLVM backend (2016) -
…python-git instead of the main Python repo. The whole project has been moved as of a couple months. https://github.com/python/cpython
comment by xapata · 2017-04-24 · in Glob Matching Can Be Simple and Fast Too -
…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 -
…(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...
comment by rocho · 2017-04-04 · in Interesting data structures: the BK-tree -
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 -
…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 -
▲ 820
Python moved to GitHubstory by c8g · 2017-02-12 · 305 comments
-
▲ 3
Python officially moved to GitHubstory by s4chin · 2017-02-11 · 0 comments
-
▲ 4
CPython is now on GitHubstory by Dowwie · 2017-02-10 · 0 comments
-
…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]:…
comment by poizan42 · 2017-01-31 · in Don't setenv in multi-threaded code on glibc -
…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 -
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 -
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 -
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 -
…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…
comment by twic · 2016-10-23 · in RFC4180 – Common Format and MIME Type for CSV Files (2005) -
▲ 2
CPython's documentation about lnotab_notes, the line number tablestory by nichochar · 2016-10-07 · 0 comments
-
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…
comment by deadowl · 2016-09-16 · in What to Do When Your Colleague Creates Spaghetti Code -
…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
comment by __s · 2016-09-03 · in Golang – encoding/csv: Reading is slow -
…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 -
…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? -
…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 -
…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 -
…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) -
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 -
https://github.com/python/cpython/commit/33455fe85760e0173ee...
comment by 0x0 · 2016-02-20 · in Python 3.4 supports only 100 regex groups -
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 -
▲ 26
Python 3.4 supports only 100 regex groupsstory by MosheZada · 2016-02-20 · 25 comments
-
…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 -
…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...
comment by pyre · 2016-02-08 · in Records: Python library for making raw SQL queries to Postgres databases -
…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]…
comment by pyre · 2016-02-07 · in Records: Python library for making raw SQL queries to Postgres databases -
…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) -
…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 -
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 -
…as c, sys as s; j.dump(j.load(s.stdin, object_pairs_hook=c.OrderedDict), s.stdout, indent=4)' [0] https://github.com/python/cpython/blob/3.5/Lib/json/tool.py#...
comment by hnov · 2015-10-20 · in Httpie: A CLI http client -
Yeah, you do: https://github.com/python/cpython/blob/master/Objects/listob... You don't need unsafe code to make any data structure in Rust. Cycles can be made just fine using std::rc::Rc. The fact that it uses `unsafe` blocks under the…
comment by kibwen · 2015-06-16 · in Go vs. Rust: Productivity vs. Performance (2014) -
yeah by using python, you will never run into problems like this https://github.com/python/cpython/search?utf8=✓&q=gethostbyn...
comment by cozzyd · 2015-01-28 · in CVE-2015-0235 – GHOST: glibc gethostbyname buffer overflow -
…the code because I don't have a debug build, so I might be completely wrong. Edit: Link to code: https://github.com/python/cpython/blob/a5c7a4257507a77699a1a...
comment by nikital · 2014-12-30 · in Python: Faster Way