Python Enum and Pydantic : accept enum member’s composition

The bounty expires in 3 days. Answers to this question are eligible for a +250 reputation bounty. Ethan Furman wants to reward an existing answer. I have an enum : from enum import Enum class MyEnum(Enum): val1 = “val1” val2 = “val2” val3 = “val3” I would like to validate a pydantic field based on … Read more

What is the __dict__.__dict__ attribute of a Python class?

>>> class A(object): pass … >>> A.__dict__ <dictproxy object at 0x173ef30> >>> A.__dict__.__dict__ Traceback (most recent call last): File "<string>", line 1, in <fragment> AttributeError: 'dictproxy' object has no attribute '__dict__' >>> A.__dict__.copy() {'__dict__': <attribute '__dict__' of 'A' objects> … } >>> A.__dict__['__dict__'] <attribute '__dict__' of 'A' objects> # What is this object? If I … Read more