4 ms·
I agree. I think Django's model system is a good example of when metaclasses can help a lot. It's essentially a domain-specific language that overcomes some of
by kennu 17y ago
I agree. I think Django's model system is a good example of when metaclasses can help a lot. It's essentially a domain-specific language that overcomes some of Python's limitations, such as remembering the order in which class attributes were defined.
I have noticed that the same sometimes applies to __getattr__ and similar Python features. You easily shoot yourself in the foot unless you are very careful. So all that stuff is best left to carefully debugged and maintained libraries, and out of everyday quickly-written application code.