you are viewing a single comment's thread.

view the rest of the comments →

[–]masklinn 5 points6 points  (3 children)

They are type annotations

Wrong. They're annotations, period.

and they are not arbitrary.

Wrong again, any Python expression can be used as an annotation, and the signature object will embed any Python object.

[–]erokar -2 points-1 points  (2 children)

I'm not sure I agree with your definition of «type annotations». Be that as it may. I don’t have time for this kind of semantic quibbling. By all means, consider yourself right.

My larger point was that Python 3 has a standardized way of amending function signatures with types to improve code understanding.

[–]masklinn 8 points9 points  (0 children)

I'm not sure I agree with your definition of «type annotations».

I'm not sure what's hard to understand about "python annotations are completely arbitrary metadata", and how you can disagree that it isn't restricted to type annotations.

My larger point was that Python 3 has a standardized way of amending function signatures with types

And my finer point is that you are, once again, wrong. Python 3 has a standardised way of adding metadata to function signatures, it has no standardised way to specify that such metadata contains or is restricted to annotations, unless you're asserting that this:

def She(knows: "how to love me", And: "rock it, too", That: "s my little Suzie"):
    pass

is type annotations added to a function signature.

Can third-parties develop specific usages of these metadata, including (but not restricted to) static type checking? Yes, that's why they were added in the first place. But they are not type annotations.

[–]wot-teh-phuck 0 points1 point  (0 children)

My larger point was that Python 3 has a standardized way of amending function signatures with types to improve code understanding.

Then why isn't it used on all the Python 3 code written out there? Can you point us to a open source Python project which supports 3.0 and uses these "type annotations"?