
On 1 May 2017 at 03:07, Guido van Rossum <guido@python.org> wrote:
There's a PR to the peps proposal here: https://github.com/python/peps/pull/242
The full text of the current proposal is below. The motivation for this is that for complex decorators, even if the type checker can figure out what's going on (by taking the signature of the decorator into account), it's sometimes helpful to the human reader of the code to be reminded of the type after applying the decorators (or a stack thereof). Much discussion can be found in the PR. Note that we ended up having `Callable` in the type because there's no rule that says a decorator returns a function type (e.g. `property` doesn't).
So a rigorous typechecker that understood the full decorator stack would be able to check whether or not the argument to `decorated_type` was correct, while all typecheckers (and human readers) would be able to just believe the argument rather than having to run through all the decorator transformations? Make sense to me. Cheers, Nick. -- Nick Coghlan | ncoghlan@gmail.com | Brisbane, Australia