Enums and nested classes

Sam Ezeh sam.z.ezeh at gmail.com
Wed Apr 20 06:57:18 EDT 2022


Hello everyone,

Has anyone here used or attempted to use a nested class inside an enum?

If so, how did you find it? (what did you expect to happen and did
your expectations align with resulting behaviour etc.)

Here are two examples describing the situation I'm talking about

```
class Outer(Enum):
    a = 1
    b = 2
    class Inner(Enum):
        foo = 10
        bar = 11
```

```
class Outer(Enum):
    a = 1
    b = 2
    class Inner:
            c = None
            def __init__(self):
                ....
```

Kind Regards,
Sam Ezeh


More information about the Python-list mailing list