Strange tab completion oddity with enums?

Piet van Oostrum piet-l at vanoostrum.org
Tue Oct 8 02:09:58 EDT 2019


Chris Angelico <rosuav at gmail.com> writes:

> I'm not sure what's going on here, and it's probably not actually
> enum-specific, but that's where I saw it.
>
> If you create a plain class and have an attribute with an annotation,
> you can see that:
>
>>>> class Foo:
> ...     spam: "ham" = 1
> ...
>>>> Foo.__a
> Foo.__abstractmethods__  Foo.__annotations__
>>>> Foo.__annotations__
> {'spam': 'ham'}

Also strange:

It shows Foo.__abstractmethods__ but there is no such attribute.
What's going on?

>>> Foo.__abstractmethods__
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: __abstractmethods__

-- 
Piet van Oostrum <piet-l at vanoostrum.org>
WWW: http://piet.vanoostrum.org/
PGP key: [8DAE142BE17999C4]



More information about the Python-list mailing list