I want to create a Python class that represents a dictionary my_dict that I want to convert as follows
my_class = MyClass(**my_dict)
The issues is that one of the dicts keys is called 'class'
So when I do as follows Python complains:
class MyClass(BaseModel)
name: str
address: str
id: int
class: str <-- Python does not like me using the keyword class
How can I get around this?
setattr.__annotations__['class'] = str-- though every metaprogramming class I tried crashed in some other way later on with aSyntaxErrorbuilding their__init__or__new__methodklassorclsorclass_because of this restriction.BaseModel? Is that from some framework, whose solution for this issue you should thus use?