On Wed, Aug 10, 2016 at 4:04 PM, Eric Snow <ericsnowcurren...@gmail.com>
wrote:
[...]
>
> Still, it would be really nice to be able to introspect a class's
> instance attributes at run-time.  A stdlib helper for that would be
> great, e.g. "inspect.get_inst_attrs(cls)".  At one point a few years
> back I wrote something like that derived from the signature of
> cls.__init__() and in the spirit of inspect.signature().  It turned
> out to be quite useful.
>

Yes, the proposal will store variable annotations for globals and for
classes in __annotations__ (one global, one per class). Just not for local
variables.


> Relatedly, it may make sense to recommend in PEP 8 that all instance
> attribute declarations in a class definition be grouped together and
> to do so right before the methods (right before __new__/__init__?).
> (...or disallow instance attribute declarations in the stdlib for
> now.)
>

Let's wait until we have some experience with how it's used before updating
PEP 8... :-)

-- 
--Guido van Rossum (python.org/~guido)
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to