<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Aug 10, 2016 at 4:04 PM, Eric Snow <span dir="ltr"><<a href="mailto:ericsnowcurrently@gmail.com" target="_blank">ericsnowcurrently@gmail.com</a>></span> wrote:<br>[...] <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Still, it would be really nice to be able to introspect a class's<br>
instance attributes at run-time. A stdlib helper for that would be<br>
great, e.g. "inspect.get_inst_attrs(cls)". At one point a few years<br>
back I wrote something like that derived from the signature of<br>
cls.__init__() and in the spirit of inspect.signature(). It turned<br>
out to be quite useful.<br></blockquote><div><br></div><div>Yes, the proposal will store variable annotations for globals and for classes in __annotations__ (one global, one per class). Just not for local variables.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Relatedly, it may make sense to recommend in PEP 8 that all instance<br>
attribute declarations in a class definition be grouped together and<br>
to do so right before the methods (right before __new__/__init__?).<br>
(...or disallow instance attribute declarations in the stdlib for<br>
now.)<span class="HOEnZb"></span><br></blockquote></div><br></div><div class="gmail_extra">Let's wait until we have some experience with how it's used before updating PEP 8... :-)<br clear="all"></div><div class="gmail_extra"><br>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">--Guido van Rossum (<a href="http://python.org/~guido" target="_blank">python.org/~guido</a>)</div>
</div></div>