11 Jan
2021
11 Jan
'21
8:05 p.m.
On 12/01/21 6:22 am, Larry Hastings wrote: * The language will set __annotations__ to a dict if the object has
annotations, or None if it has no annotations.
That sounds inconvenient -- it means that any code referencing __annotations__ has to guard against the possibility of it being None. If we're changing things, I'm wondering if the best thing would be to introduce an annotations() function as the new best practice for getting an object's annotations. It would know how to handle all the type-specific pecularities, and could take care of things such as manufacturing an empty dict if the object doesn't have any annotations. -- Greg