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?

I'm going to *love* explaining the difference to beginners when they 
accidently do this and try to call func.

Python is not Scratch and is not intended as a teaching language for 
kids, but some proposals are actively hostile to beginners, and I think 
this is one. Have we considered how this would effect something as 
simple as the meaning of keywords?

- `class` creates classes, also known as types;

- `def` creates functions, and also types, but not types you can use
  for anything except type-checking.

Given that annotations are optional everywhere else, what happens if you 
leave out the annotations in the type definition?

    def SomethingFunction(x)

Is that the same as Callable[[Any], Any] or Callable[[None], None]?

Or are we going to create a rule that annotations are mandatory in some 
`def`s but optional in others?

-- 
Steve
_______________________________________________
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/5GXCY64PHTNBXXUHL4ULDVSECX2DWWIC/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to