I'm coding derived attributes separately from their elements so that their rules are reused : def getLocal(name): class attr(model.Attribute): # some 'local' rules here attr.attrName = name return attr class MyElement(model.Element): foo = getLocal('foo') bar = getLocal('bar') How could I avoid double naming as in "foo = getLocal('foo')" ?