#!/usr/local/bin/python2 class M(type): def __new__(cls, clsname, bases, dict): if 'name' not in dict: for base in bases: if hasattr(base, 'name'): dict['name'] = base.name break else: dict['name'] = clsname[0].lower() + clsname[1:] return type.__new__(cls, clsname, bases, dict) class C(object): __metaclass__ = M name = 1 class C2(C, list): pass print C.name