HN Hall of Fame Weekly email

Crimes with Python's pattern matching

www.hillelwayne.com Essays & writing Essays & articles Software engineering Candidate
Screenshot of www.hillelwayne.com captured 2026-07-20
Page preview · captured 2026-07-20

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

submissions
3
submitters
3
observed span
2022–2025
peak thread · 120 comments
406 pts
latest 20+ return · 2025-08-21
255 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

Looking in the implementation of the Python version of ABC[0], you'll see that `__subclasshook__` doesn't do any language magic, it just registers the method to be called in `__instancecheck__`. So if you just implement `__instancecheck__` directly, you get the same behavior, but without the caching around it. class OneWayMeta(type): seen_classes = set() @classmethod def __instancecheck__(cls, instance): C = instance.__class__ print(f"trying {C}") if C in cls.seen_classes: return False cls.seen_classes |= {C}…

w-m·406-point thread·

My favorite Python "crime" is that a class that defines __rrshift__, instantiated and used as a right-hand-side, lets you have a pipe operator, regardless of the left-hand-side (as long as it doesn't define __rshift__). It's reasonably type-safe, and there's no need to "close" your chain - every outputted value as you write the chain can have a primitive type. x = Model.objects.all() >> by_pk >> call(dict.values) >> to_list >> get('name') >> _map(str.title) >> log_debug >> to_json It shines in notebooks…

btown·255-point thread·

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
2

100+ points or 50+ comments

Total points
667

reference only — not used in Hall rules or ranking

Total comments
233

reference only — not used in Hall rules or ranking

Every submission

DateTitle as submittedByPointsComments
2022-08-01Crimes with Python's Pattern Matchingtodsacerdoti60
2022-08-02Crimes with Python's pattern matchingFirst breakout · Best threadsigna11406120
2025-08-21Crimes with Python's Pattern Matching (2022)Latest 20+ point returnagluszak255113