[Python-3000] Metaclasses in Py3K
Phillip J. Eby
pje at telecommunity.com
Sat Dec 16 23:51:05 CET 2006
At 02:39 PM 12/16/2006 -0700, Steven Bethard wrote:
> > The main issue for me is that I think that its important to distinguish
> > between get/set operations that are done at class definition time, and
> > get/set operations that are done later, after the class is created.
>
>Why? Can you explain your use case? Everything I'd care to do would
>treat later get/set operations on the class in the same way.
The above was actually Talin's statement, but I agree that there are
circumstances where you want to know when the contents of the class are
essentially finalized:
1. Validation -- have a point at which it's an error to have *not* set
certain things
2. Setup of data structures that are expensive or complex to update
incrementally during the process of class construction
For both of these things you want to know when the class is "ready", so to
speak, and they are easily accommodated with today's metaclass construction
protocol.
More information about the Python-3000
mailing list