type hinting backward compatibility with python 3.0 to 3.4
On Sat, 20 May 2017 11:57 am, Chris Angelico wrote:
> They're function metadata. What would the principle of least surprise
> say about this?
> def func(arg: print("Foo") = print("Quux")):
> What should be printed, and in what order?
but I wouldn't be the least bit astonished if Foo and Quux are in the
opposite order. As in fact they are.
> Actually, Python does violate least-surprise in one area here. There's
> one message that gets printed "out of order" compared to my
> expectation. I wonder if it's the same one that other people will be
> surprised at.
The reason appears to be that the default arguments are evaluated first,
from left to right, followed by the annotations:
py> def func(a:print(1)=print(2), b:print(3)=print(4), c:print(4)=print(5)):
Emoji: a small, fuzzy, indistinct picture used to replace a clear and
perfectly comprehensible word.