What can be done with metaclasses that can't be in any other way?
Alex Martelli told that there are tasks that can't be achieved without metaclasses here Python metaclasses vs class decorators I'd like to know which are?
What can be done with metaclasses that can't be in any other way?
Alex Martelli told that there are tasks that can't be achieved without metaclasses here Python metaclasses vs class decorators I'd like to know which are?
The first commentator states that the use of metaclasses here was 'a gemstone' that helped him track down unexpected errors that had been occurring for (many) 'days'.
They are rarely needed, but come in useful in places where you want to add behavior to the basic behavior of an object -- compare Aspect Oriented Programming, or the instrumentation done in persistence frameworks like Hibernate.
For example, you may want a class which persists or logs each new object.