On Dec 23, 2021, at 17:09, Guido van Rossum <gu...@python.org> wrote:
> 
> Mark's proposal was
> ```
> @Callable
> def func(params): pass
> ```
> My question is, why does it need `@Callable`? Lukasz proposed just using any 
> (undecorated) function, with the convention being that the body is `...` (to 
> which I would add the convention that the function *name* be capitalized, 
> since it is a type). My question (for Mark, or for anyone who supports 
> `@Callable`) is why bother with the decorator. It should be easy to teach a 
> type checker about this:
> 
> ```
> def SomeFn(x: float) -> int:
>     ...
> 
> def twice(f: SomeFn) -> SomeFn:
>     return lambda x: f(f(x))
> ```

That seems pretty intuitive to me.  The conventions you mention would be just 
that though, right?  I.e. `pass` could be used, but whatever the body is it 
would be ignored for type checking `twice()` in this case, right?

-Barry


Attachment: signature.asc
Description: Message signed with OpenPGP

_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/BRYQ26TIYPITNDOYYYGBDFS5EYEOZVUA/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to