Does Class implements Interface?

Jonathan Gardner jgardner at jonathangardner.net
Thu Aug 27 18:25:09 EDT 2009


On Aug 27, 3:09 pm, "Emanuele D'Arrigo" <man... at gmail.com> wrote:
> On Aug 27, 9:42 pm, Jonathan Gardner <jgard... at jonathangardner.net>
> wrote:
>
> > Have you heard of duck typing?
>
> Yes.
>
> I was just wondering then if this has been somewhat dealt with and has
> been wrapped in a neat package, set of functions, recipe or pattern.
>

As a joke (but only partly), here's the python code you'd use to check
to see if a value conforms with expectations:

<code>
</code>

As you can see, the above code is not only easy to write, but easy to
write unit tests for, compile, run, and debug. It simply doesn't get
better than this.



More information about the Python-list mailing list