On Thu, Dec 23, 2021 at 3:24 PM Steven D'Aprano <st...@pearwood.info> wrote:

> On Thu, Dec 23, 2021 at 02:09:50PM -0800, Guido van Rossum wrote:
>
> > Without decorator too (that was Lukasz’ idea). Why bother with the
> > decorator (*if* we were to go there)?
>
> So that
>
>     def func(params): pass
>
> creates a function object, and
>
>     def func(params)
>
> makes a Callable type object?
>

No, no, no. That syntax has already been discredited.

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))
```


-- 
--Guido van Rossum (python.org/~guido)
*Pronouns: he/him **(why is my pronoun here?)*
<http://feministing.com/2015/02/03/how-using-they-as-a-singular-pronoun-can-change-the-world/>
_______________________________________________
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/ZCKXJJOADSBH7FLZQ3KGHTMDHFI7NCHA/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to