
On 5 January 2016 at 10:26, Guido van Rossum <guido@python.org> wrote:
On Sat, Jan 2, 2016 at 10:42 PM, Nick Coghlan <ncoghlan@gmail.com> wrote:
Always allocating f.__annotations__ actually puzzled me a bit - did we do that for a specific reason, or did we just not think of setting it to None when it's unused to save space the way we do for other function attributes? (__closure__, __defaults__, etc)
Where do you see that happening? The code in funcobject.c seems to indicate that it's created on demand. (And that's how I remember it always being.)
I didn't check the code, only the behaviour, so I missed that querying f.__annotations__ was implicitly creating the dictionary. Cheers, Nick. -- Nick Coghlan | ncoghlan@gmail.com | Brisbane, Australia