>>> def foo(): pass
>>> foo.__annotations__
{}
Probably an oversight. I'm also not a C expert, but func_get_annotations (line 396 and onwards in funcobject.c) explicitely returns a new, empty dict if the function doesn't have any annotations (unlike all the other slots, like __defaults__ or __kwdefaults__, which merely return None if they're not present).
From: guido@python.org
Date: Mon, 4 Jan 2016 16:26:53 -0800
To: ncoghlan@gmail.com
Subject: Re: [Python-ideas] Bad programming style in decorators?
CC: python-ideas@python.org; surya.subbarao1@gmail.com
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/