
Shouldn't this be tied to ABCs rather than redesigning and reimplementing most of ABC to add a little bit on top? Sent from a random iPhone On Dec 2, 2013, at 7:55, Gregory Salvan <apieum@gmail.com> wrote:
Hi, I've made a try of a function that check object/class members for duck typing.
For now I've basically called it isducktype(X, A) it returns true if: - X has all attributes of A - X methods have same number of arguments than corresponding A methods
or if A.__ducktypecheck__(X) returns True
Behaviour looks like isinstance and issubclass (support tuples...).
To test it: The patch with example is here: https://gist.github.com/apieum/7751279
Or you can use my branch here: https://bitbucket.org/gsalvan/cpython/commits/branch/default
Any opinion about a feature like this ? _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas