to: @wozozo metaclass1.py # coding:utf-8 class MyMetaclass(type): """ ã¡ã¿ã¯ã©ã¹ """ def __new__(cls, name, bases, attrs): # fieldsã¨ããååã®ãã£ã¼ã«ãããã¡ã½ãããçæãã def make_method(v): # ã¯ãã¼ã¸ã£ return lambda self: "%s" % v for k, v in attrs.get('fields', {}).iteritems(): attrs[k] = make_method(v) return type.__new__(cls, name, bases, attrs) class MyBaseClass(object): """ ã¡ã¿ã¯ã©ã¹ã使ã£ãã¯ã©ã¹ """ __metaclass__ = MyMetaclas
{{#tags}}- {{label}}
{{/tags}}