KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
According to Python's documentation , Data descriptors with __set__() and __get__() defined always override a redefinition in an instance dictionary. I have no problem understanding this sentence, but can someone clarify for me why such a rule is in place? After all, if I want to override an attribute in an instance dictionary, I already need to do that explicitely ( inst.__dict__["attr"] = val ), as a naive inst.attr = val would call the descriptor's __set__ method, which would (usually) not override the attribute in the instance dictionary. edit: just to make it clear, I understand what is happening, my question is about why such a rule was put in place.
Tags (comma-separated)
Save Edits
Cancel