[Python-ideas] Optional static typing -- the crossroads
Greg Ewing
greg.ewing at canterbury.ac.nz
Mon Aug 18 01:43:51 CEST 2014
Chris Angelico wrote:
> I don't, for instance, see
> real-world examples of decorators that add extra parameters to a
> function, even though it would be plausible
Some decorators, such as property(), don't return a
function at all. Ignoring the decorator in that case
would give completely the wrong idea.
I'm now thinking the right thing to do with decorators
is to analyse them statically if possible, otherwise
treat the result as untyped.
If a decorator is well-behaved, type inference should
be able to propagate the types of the decorated
function through to the result. If not, all bets
are off.
--
Greg
More information about the Python-ideas
mailing list