[Python-Dev] Re: The current state of typing PEPs

2021年11月29日 18:04:11 -0800

On 11/29/2021 8:16 PM, Guido van Rossum wrote:
On Mon, Nov 29, 2021 at 5:01 PM Terry Reedy <[email protected] <mailto:[email protected]>> wrote:
 On 11/29/2021 5:56 PM, Barry Warsaw wrote:
 > On Nov 25, 2021, at 13:41, Christopher Barker
 <[email protected] <mailto:[email protected]>> 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.
Chris, can you say anything more about why people would get such a mis-impression?
 > 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?
The people that Chris B. referred to, and their 'sources'. But we need more info to know how to best counter such wrong beliefs.
--
Terry Jan Reedy
_______________________________________________
Python-Dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/KLJ7UCGAWQ7X5EW6WPHBIH2XC3DIVEFZ/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to