Question about accessing class-attributes.

Duncan Booth duncan at NOSPAMrcp.co.uk
Thu Apr 24 10:30:03 EDT 2003


Alex Martelli <aleax at aleax.it> wrote in 
news:EARpa.120$3M4.2728 at news1.tin.it:

> ..isn't this smoother and handier?  Or does it just look that way
> to me, due to overexposure to custom metaclasses?-)
> 
Yes, I agree that it is better, but I have one niggling worry about this:

Your metaclass works fine for the one requirement given here, and other 
metaclasses you have proposed work fine in their place, but what happens if 
you want to combine these and get e.g. a Bunch which counts its instances?

I haven't tried it to see what happens, maybe you just need to indirect 
type.__new__ calls through super, and make a new submetaclass with the old 
metaclasses as bases, but I'd like to know if there are issues here or if 
I'm just worrying needlessly.

-- 
Duncan Booth                                             duncan at rcp.co.uk
int month(char *p){return(124864/((p[0]+p[1]-p[2]&0x1f)+1)%12)["\5\x8\3"
"\6\7\xb\1\x9\xa\2\0\4"];} // Who said my code was obscure?




More information about the Python-list mailing list