This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author larry
Recipients Guido.van.Rossum, eric.smith, gvanrossum, larry
Date 2021-04-24.21:10:23
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1619298623.95.0.742555774132.issue43901@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2021-04-24 21:10:23larrysetrecipients: + larry, gvanrossum, eric.smith, Guido.van.Rossum
2021-04-24 21:10:23larrysetmessageid: <1619298623.95.0.742555774132.issue43901@roundup.psfhosted.org>
2021-04-24 21:10:23larrylinkissue43901 messages
2021-04-24 21:10:23larrycreate