Why are we using `:data:` and `:class:` for types in `typing` and `types`?

In BPO-45391, @bernatgabor finds that many of our classes are in fact marked with :data: in the documentation. This makes intersphinx fail to address those. (intersphinx is an extension to Sphinx that allows linking to documentation in another project; so if any end user uses it in the documentation of their project, they can nicely link back to Python docs where needed).

Now, I would “just fix it” but it seems to me like using the :data: marker was deliberate for those types, there are many of them in both typing and types. If anyone here knows why that is, please let me know. I don’t want to break stuff by changing the markers to :class:.

2 Likes

My guess is that most of them aren’t actually classes (E.g. isinstance(List, type) == False).

I do agree it’s confusing. I’ve struggled to decide between :data: or :class: when writing docs for new types added recently.