Steven D'Aprano <steve+comp.lang.pyt...@pearwood.info> writes:
> versus any other decorator, but the STRING:
> "@typehint(...)"
> being used where a decorator would normally be expected.

I didn't catch that either.  I think if hints are to go in decorators,
then it's best to extend the decorator mechanism to allow arbitrary
syntax, e.g.

@-typehint (str, int) -> bool

The @- would signify that the typehint function is to receive an AST as
its argument, rather than its callable.  The AST would be the parse tree
for the rest of the line.  Alternatively, it could get the line as a
string and parse it with appropriate functions from the ast module.
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to