Larry Hastings <la...@hastings.org> added the comment:

I'm not breaking backwards compatibility--that's the point of all this.  But 
I'm improving the experience.  And if you don't care about 3.9 and before, you 
can stick to the new improved experience.

Looking in the class dict for annotations is terrible, but that's best practice 
for 3.9 and earlier because of the flawed design of annotations.

For 3.10+, best practice to look at annotations is inspect.get_annotations() 
for all objects.  But this isn't best practice for 3.9, because the function 
didn't exist in 3.9.  Also, the paragraph might go on to say, if you have a 
good reason why you can't call inspect.get_annotations(), best practice no 
longer requires you to look in the class dict, because of this very issue/PR 
that is behavior we are changing for 3.10.

So, best practices changed in 3.10.  And I plan to add a section to the docs 
somewhere that says "Here are best practices for accessing annotations in 
3.10+".  As I said, if you think the Python 3.10 docs should have a section 
about "here are best practices in 3.9", I can add that too, but it'll be a 
different paragraph.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue43901>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to