[Python-ideas] Should nested classes in an Enum be Enum members?

Ethan Furman ethan at stoneleaf.us
Wed Jun 27 15:25:58 EDT 2018


On 06/27/2018 12:04 PM, Elazar wrote:
 > בתאריך יום ד׳, 27 ביוני 2018, 11:59, מאת Guido van Rossum:

 >> Sounds to me really strange that the nested class would become a member.
 >> Probably because everything becomes a member unless it's a function
 >> (maybe decorated)?
 >
> People working with sum types might expect the instances of the nested
 > class to be instances of the enclosing class. So if the nested class is
 > a namedtuple, you get a sum type. The only problem is that there's no
 > way to express this subtype relationship in code.

I have no idea what you just said.  :(  Is there a link you can share that might explain it?

--
~Ethan~


More information about the Python-ideas mailing list