osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

type hinting backward compatibility with python 3.0 to 3.4


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