News for hackers. Stuff that matters.
Re:Crimes with Python's pattern matching by shadycuz on Tuesday August 02, 2022 @12:26AM (#32315076)
He is just demonstrating that __subclass__ hook has control over what is counted as a match.

Which he explained in another article that it allows the author of the abstract class to hijack calls to isinstance for any instances created from subclasses.

Re:Crimes with Python's pattern matching by bilboa on Tuesday August 02, 2022 @10:21AM (#32318819)
The point though is that the tone of his article seems to suggest that this is some scary "gotcha" of the language, whereas some of us consider this to just be the expected behavior.
Re:Crimes with Python's pattern matching by shadycuz on Tuesday August 02, 2022 @08:20PM (#32326110)
Well to me the "gotcha" wasn't that you could control the match from the abstract class, it was all the silly things that you could do. Which for me was the point of the article. I mean the first palindrome example was pretty cool no?