On Wed, Aug 10, 2016 at 11:56 AM, Guido van Rossum <gu...@python.org> wrote:
> Sounds like you're thinking with your runtime hat on, not your type checker
> hat. :-)
>
> On Tue, Aug 9, 2016 at 9:46 PM, Neil Girdhar <mistersh...@gmail.com> wrote:
>>
>> With PEP 520 accepted, would it be possible to iterate over
>> __definition_order__?

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.

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.)

-eric
_______________________________________________
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