[Python-Dev] Re: Enum and annotations

2019-06-11 Thread Ivan Levkivskyi
On Mon, 10 Jun 2019 at 22:37, Ethan Furman wrote: > Greetings! > > I saw my first annotation mix-up with regards to Enum today: > >https://stackoverflow.com/q/56532591/208880 > > #enum import: > from enum import Enum > > # enum definition: > class Status(Enum): >

[Python-Dev] Re: Enum and annotations

2019-06-10 Thread Jonathan Goble
On Mon, Jun 10, 2019 at 6:44 PM Steve Dower wrote: > > I'd expect people coming from other languages to get it wrong this way too: > > class Status(Enum): > on > off > > Which will of course raise NameError and be just as opaque to the naive > user as the AttributeError later on. I'm not

[Python-Dev] Re: Enum and annotations

2019-06-10 Thread Steven D'Aprano
On Mon, Jun 10, 2019 at 02:29:56PM -0700, Ethan Furman wrote: > Greetings! > > I saw my first annotation mix-up with regards to Enum today: [...] I don't think this is particular to Enums. I think this is going to be a stumbling block for any class. py> class X: ... a: 1 ... b: 2 ... py

[Python-Dev] Re: Enum and annotations

2019-06-10 Thread Steve Dower
On 10Jun2019 1429, Ethan Furman wrote: I saw my first annotation mix-up with regards to Enum today:   https://stackoverflow.com/q/56532591/208880     #enum import:     from enum import Enum     # enum definition:     class Status(Enum):     on: 1     off: 2 For those who don't