Hacker News new | ask | show | jobs
by wyattpeak 2292 days ago
While I agree the notation is a bit weird, I disagree that there is any standard notation for types. The Python docs in particular fail for exactly one of the things I like about TFA - it tells you the type of the output of each function in its angle-bracketed style.

Take, for example, the definition of the operation s[i:j] in the Python docs: the result is "slice of s from i to j". Is that the same type as the input? Is it an iterator? No information.

I doubt most people are confused about the output, but a reference is specifically for people who are uncertain about how a function works.

1 comments

You're right that there is not any official standard.

But almost every major library follows a convention that's very similar to the cpython docs.

If you're making a language reference, shouldn't it look like the language ?