On 11/29/2021 5:56 PM, Barry Warsaw wrote:
On Nov 25, 2021, at 13:41, Christopher Barker <[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.
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.
--
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/R2HLTW5DZQGKCMJTTFTAKHX7EYQWNROG/
Code of Conduct: http://python.org/psf/codeofconduct/