type hinting backward compatibility with python 3.0 to 3.4

Gregory Ewing greg.ewing at canterbury.ac.nz
Sat May 20 09:58:53 EDT 2017


Chris Angelico wrote:
> They're function metadata. What would the principle of least surprise
> say about this?
> 
> print("Spam")
> def func(arg: print("Foo") = print("Quux")):
>     print("Blargh")
> print("Fred")
> func()
> print("Eggs")

Most languages that have static type declarations wouldn't
let you write something like that in the first place, so the
fact that Python does is surprising to begin with.

-- 
Greg



More information about the Python-list mailing list