id
type
5 (blog/news article)
status
21 (imported old-v2, waiting for another import)
review version
0
cleanup version
0
pending deletion
0 (-)
created at
2025-12-04 09:23:51
updated at
2025-12-04 09:23:52
url
https://hillelwayne.com/post/python-abc/
url length
40
url crc
38739
url crc32
452237139
location type
1 (url matches target location, page_location is empty)
canonical status
30 (canonical url is different, page_canonical_page_id points to it)
canonical page id
domain id
domain tld
2211
domain parts
0
originating warc id
-
originating url
https://data.commoncrawl.org/crawl-data/CC-MAIN-2025-33/segments/1754151279901.12/warc/CC-MAIN-20250806074443-20250806104443-00349.warc.gz
source type
11 (CommonCrawl)
server ip
Publication date
2025-08-06 08:40:12
Fetch attempts
0
Original html size
41783
Normalized and saved size
38885
title
Crimes with Python's Pattern Matching
excerpt
content

 One of my favorite little bits of python is __subclasshook__. Abstract Base Classes with __subclasshook__ can define what counts as a subclass of the ABC, even if the target doesn’t know about the ABC. For example: class PalindromicName(ABC): @classmethod def __subclasshook__(cls, C): name = C.__name__.lower() return name[::-1] == name class Abba: ... class Baba: ... >>> isinstance(Abba(), PalindromicName) True >>> isinstance(Baba(), PalindromicName) False You can do some weird stuff with this. Back in 2019 I used it to create non-monotonic types, where something counts as a NotIterable if it doesn’t have the __iter__ method. There wasn’t anything too diabolical you could do with this: nothing in Python really interacted with ABCs, limiting the damage you could do with production code. Then Python 3.10 added pattern matching. A quick overview of pattern matching From the pattern matching tutorial: match command.split(): case...
author
updated
1764920966
block type
0
extracted fields
232
extracted bits
title
full content
content was extracted heuristically
OpenGraph suggests this is an article
detected location
0
detected language
1 (English)
category id
-
index version
1
paywall score
0
spam phrases
0
text nonlatin
1
text cyrillic
0
text characters
5468
text words
1282
text unique words
400
text lines
1
text sentences
55
text paragraphs
1
text words per sentence
23
text matched phrases
0
text matched dictionaries
0
links self subdomains
0
links other subdomains
0
links other domains
7
links spam adult
0
links spam random
0
links spam expired
0
links ext activities
0
links ext ecommerce
0
links ext finance
0
links ext crypto
0
links ext booking
0
links ext news
0
links ext leaks
0
links ext ugc
0
links ext klim
0
links ext generic
0
image author
featured image