From c51c01869cf07993df3df0dd487d863af9e04fca Mon Sep 17 00:00:00 2001 From: Ivan Levkivskyi Date: Sun, 11 Sep 2016 18:52:19 +0200 Subject: [PATCH] Mention that private variable annotations are mangled (#101) (Implemented in http://bugs.python.org/issue28076, https://hg.python.org/cpython/rev/1c2a4f29e1ab.) --- pep-0526.txt | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pep-0526.txt b/pep-0526.txt index 12413a793..e0f51b231 100644 --- a/pep-0526.txt +++ b/pep-0526.txt @@ -384,16 +384,19 @@ evaluated:: In addition, at the module or class level, if the item being annotated is a *simple name*, then it and the annotation will be stored in the -``__annotations__`` attribute of that module or class as a dictionary mapping -from names to evaluated annotations. Here is an example:: +``__annotations__`` attribute of that module or class (mangled if private) +as a dictionary mapping from names to evaluated annotations. +Here is an example:: from typing import Dict class Player: ... players: Dict[str, Player] + __points: int print(__annotations__) - # prints: {'players': typing.Dict[str, __main__.Player]} + # prints: {'players': typing.Dict[str, __main__.Player], + # '_Player__points': } ``__annotations__`` is writable, so this is permitted::