'Zen of Typing'?

Wondering if the typing council would like to come up with a little set of guiding principles for the typing module, and have it be printed when you do python -m typing, similar to Zen of Python.

Is this even a good idea? Is now the right time for it?

7 Likes

Given all the discussion I’ve seen, perhaps a starting point would be: “The type that can be annotated is not the true type.” :slight_smile:

5 Likes

Ha, that’s a fun idea. I’d be interested to see what folks come up with!

The closest thing we have in practice is what we put forward as the Typing Council’s mandate in PEP 729: PEP 729 – Typing governance process | peps.python.org , although a far cry from the voice and humour that Tim gave the Zen.

1 Like

Can one of the @moderators maybe move this to the typing category? Feels like it’d be more appropriate there, where all the typing people will actually see it.

Implicit is better than explicit
Unless you're saying that field is a list[int] and its actually a Iterable[int]
2 Likes

Slightly related would be something like: Keep your input types broad and output types concrete

11 Likes

I agree this is fun, but given how often the Zen of Python comes up in language design discussions, and how often it needs to be dismissed as not very meaningful, it sounds like a mistake to introduce another source of overly simple answers to complicated questions.

But, on the other hand, perhaps it’s possible to capture something along those lines in such design principles…

4 Likes

Something like: A class is not a type, but you can pretend it is. And even though type is a class, a type is not a class.