Steve D'Aprano wrote:
You mean treat them as syntactically comments?
def function(arg:I can put ***ANYTHING*** I like here!!!):
They could be parsed as expressions and stored as an AST.
That would allow introspection, and you could evaluate them
if you wanted
Ever since they were introduced, annotations have always been evaluated and
recorded in the function.__annotations__ attribute.
Yes, but I'm not sure how much good that does you. Because
of the forward-reference thing, you need to be prepared to
get a string instead of a type object, in which case you
need to do some evaluation on it yourself anyway.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list