HN Hall of Fame Weekly email

Comprehensive Python Cheatsheet (2018)

gto76.github.io Reference Documentation & references Software engineering Class of 2021-12 Hall of Fame
Screenshot of gto76.github.io captured 2026-07-20
Page preview · captured 2026-07-20

Resurfaced independently across 6 calendar years, with breakout response in 3 of them.

submissions
11
submitters
5
observed span
2018–2024
peak thread · 81 comments
335 pts
latest 20+ return · 2023-07-20
295 pts

Submission timeline

2007–2026

One slot for every year since HN launched. Height is that year's peak points; orange marks a 100+ point or 50+ comment breakout. Select a bar to open its strongest thread.

First comments on top threads

HN comment order

I like the basic script template that the author provides. However, when I start development of new code I always use a script that starts off with traceback and pdb, something like this: #!/usr/bin/env python import traceback import pdb import sys def main(): # some WIP code that maybe raises an exception raise BaseException("oh no, exception!") return 0 if __name__ == "__main__": try: ret = main() except: traceback.print_exc() pdb.post_mortem() sys.exit(ret) This means that whenever an uncaught exception gets…

gorb314·335-point thread·

Previous discussion: https://news.ycombinator.com/item?id=29679788 (243 points | Dec 25, 2021 | 57 comments) See also: * Python Crash Course cheatsheet: https://ehmatthes.github.io/pcc_3e/cheat_sheets/ * Scientific Python cheatsheet: https://ipgp.github.io/scientific_python_cheat_sheet/ * Common beginner errors: https://pythonforbiologists.com/29-common-beginner-errors-on... * Python regular expression cheatsheet: https://learnbyexample.github.io/python-regex-cheatsheet/ — my blog post, includes examples as well

asicsp·295-point thread·

I'm surprised to see mutable default values not mentioned. It's bitten me more than once to discover that: def f(xs = []): xs.append(5) return xs print(f()) print(f()) will print: [5] [5,5] and I love python despite this horrendous decision, but it should be mentioned more often in beginner resources. edit: thanks for the downvote? I've answered on the order of dozens of questions about this very mechanic on SO, via IRC, and more... it's a well-known confusing factor

Source: https://www.cs.princeton.edu/courses/archive/spring19/cos333...

The first top-level comment from each of the four biggest threads, in HN’s own order. Excerpts are shortened; open a comment for full context.

Breakout years
3

100+ points or 50+ comments

Total points
899

reference only — not used in Hall rules or ranking

Total comments
179

reference only — not used in Hall rules or ranking

Every submission

DateTitle as submittedByPointsComments
2018-12-27A comprehensive Python cheatsheetsidcool60
2019-02-04Comprehensive Python Cheatsheet (2018)First breakout · Best threadpizzaburek33581
2019-07-11Best Python Cheatsheet Everpizzaburek30
2020-06-29Comprehensive Python CheatSheet, now with Pandas and more librarieschirau50
2020-11-03Comprehensive Python Cheatsheetsigna1120
2020-12-25Comprehensive Python Cheatsheet (2020)zombiemama40
2020-12-26“A helpful (Python) cheat sheet, quite long.” ― Brian Kernighanzombiemama31
2021-12-25A Python Guide for the AgesHall inductionzombiemama24357
2023-07-20Comprehensive Python “Cheatsheet”Latest 20+ point returnzombiemama29540
2024-10-17Python Cheatsheetzombiemama10
2024-10-18Comprehensive Python Cheatsheetzombiemama20