On Mon, Nov 29, 2021 at 5:01 PM Terry Reedy <tjre...@udel.edu> wrote:

> On 11/29/2021 5:56 PM, Barry Warsaw wrote:
>
> > On Nov 25, 2021, at 13:41, Christopher Barker <python...@gmail.com>
> wrote:
> >> What is their role? Up to today, I have treated them as an advanced
> feature, useful for "complex codebases". But there are any number of
> examples springing up on the internet, to the point where many students now
> think they are "best practice", if not actually required.
>
> > This is an important observation.  As much as I’m in the "type
> annotations are good” crowd now, I still think they should always be
> optional.  Python’s use is so broad these days, I for one don’t want to
> have to add annotations to every bit of Python I write.
>
> Maybe it should be reiterated with whatever decision comes forth that
>
>  >>> def muladd(x, y, z):
> ...     return x * (y+z)
> ...
>  >>> muladd(3.1459, 87.33, 2.7e2)
> 1124.124447
>  >>> muladd(3, 5, 7)
> 36
>  >>> from fractions import Fraction as Fr
>  >>> muladd(Fr(22, 7), 87, Fr(2714, 100))
> Fraction(62777, 175)
>  >>> muladd(3, 'hel', 'lo ')
> 'hello hello hello '
>
> and other duck-typed code will always be legal, idiomatic, and even
> expected as good practice for beginner, informal, exploratory, and
> similar python code.
>

Why would it need to be reiterated? Are there really people who believe
that such code would become invalid? AFAIK *everybody* here agrees that
this should stay valid. So who would we be reiterating it for?

(Yes, several static type checkers have options that cause the checker to
complain about unannotated code. But that's not the default behavior and
running a static checker is a choice, like running a linter. Three-space
indents or capitalized function names are never going to be disallowed
either, even though PEP 8 says that's not how you ought to code.)

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

Reply via email to