Hello Python devs, As a regular Python user, I find the abc module useful for making Python's duck typing more explicit. In particular, I ofen use it like a Java interface or C header, to provide methods to implement for a given "duck type".
90% of the time, it ends up looking something like this: class Foo(metaclass=abc.ABCMeta): @abc.abstractmethod def f1(self): raise NotImplementedError @staticmethod @abc.abstractmethod def f2(arg1): raise NotImplementedError ... What if there was a function, say make_abstract_method (better name pending), so that the above could be written like: class Foo(metaclass=abc.ABCMeta): f1 = abc.make_abstract_method('f1', ['self']) f2 = staticmethod(abc.make_abstract_method('f2', ['arg1'])) ... I think that it would make ABC definitions a lot more compact for many use cases, but I welcome any criticisms against this idea. Allen Li _______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com