Issue found on the Python docs!

dec 6, 2023

At the end of my second video working on the pathlib deck, this funny moment happened in which I was pretty confused at why this was not working:

>>> from pathlib import PurePath
>>> pattern = PurePath("*.py")
>>> PurePath("hello.py").match(pattern)

It turns out, matching a path to a path and not to a string is something that is only possible since Python 3.12, but this is not documented anywhere! It is not stated in the docs, and as far as I can tell, it wasn't included in the Python 3.12 release notes either.

This led to my first issue reported on the CPython project, which was quickly picked up and hopefully will result in a clarification on the docs.

Python documentation is sublime overall, and the issue I found is obviously not critical. However, I'm very happy because finding these kinds of issues means that we are really distilling the pathlib module functionality into the deck of cards, and we are being faithful to the title: pathlib in depth.