# coding=utf8
from functools import partial


def ask(self, question):
    print("{name}, {q}?".format(name=self["name"], q=question))


def talk(self):
    print("我说: {topic}".format(topic=self["topic"]))


def cls(**methods):
    def bind(self):
        return lambda method_item: (method_item[0], partial(method_item[1], self))

    return lambda **attrs: dict(
        list(attrs.items()) + list(map(bind(attrs.copy()), list(methods.items())))
    )


Speaker = cls(ask=ask, talk=talk)
me = Speaker(name="hehe", topic="ppp")
me['talk']()
me['ask']('1231')