type hinting backward compatibility with python 3.0 to 3.4

Gregory Ewing greg.ewing at canterbury.ac.nz
Fri May 19 21:42:09 EDT 2017


Steve D'Aprano wrote:
> On Fri, 19 May 2017 11:35 pm, Edward Ned Harvey (python) wrote:
> 
>> I *thought* python 3.0 to 3.4 would *ignore* annotations, but it
>> doesn't...
> 
> Why would you think that?

Ever since Guido retconned the purpose of annotations to be
for static type hinting *only*, it would make more sense for
the interpreter to ignore them, or at least not evaluate them
immediately at run time (since it would avoid all the problems
of forward references, etc).

So I can see how someone relying on the principle of least
surprise might assume that.

-- 
Greg



More information about the Python-list mailing list