As pointed out, you want metaclass for this. A warning, I've overwritten many 
of the dunders on classes for fun and I actually broke the ability to repr my 
class in certain situations by overriding __eq__ and/or __hash__ something deep 
in ipython/python with the repr. I forget the exact situation, I think I 
implemented __eq__ but not __hash__ and it broke the golden rule of x == y => x 
is y i,.e. hash(x) == hash(y) 

Great way to really learn the data model but you will be in for a bit of pain 
trying to debug these things.
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/AVQDN2XIMOXQ6CJLYPVZCNZGBDLXMEHN/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to