Instances behaviour

bruno at modulix onurb at xiludom.gro
Fri Dec 2 07:19:02 EST 2005


Mr.Rech wrote:
> Thanks for your suggestions. They are very usefull and indeed bypass my
> problem. However, I've found a (perhaps) more elegant way to get the
> same result using metaclasses. 


(snip code)
> 
> I know metaclasses are a complete different beast, anyway I find this
> approach more pythonic. 

It's not. It's a case of ArbitraryOvercomplexification(tm).

The pythonic way is to use inheritence and make the base class abstract
by raising a NotImplementedError in it's __init__ (cf Inyeol Lee's
answer and my small correction)


-- 
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'onurb at xiludom.gro'.split('@')])"



More information about the Python-list mailing list