[Python-ideas] ABC: what about the method arguments ?

Dj Gilcrease digitalxero at gmail.com
Fri Sep 24 05:42:41 CEST 2010


On Thu, Sep 23, 2010 at 1:51 PM, Tarek Ziadé <ziade.tarek at gmail.com> wrote:
> Why are you thinking about unit tests  ? Don't you ever use
> issubclass/isinstance in your programs ?
>
> Checking signatures using ABC when you create a plugin system is one
> use case for instance.

This is something that I have implemented (before ABCs) in plugin
systems I use. When loading the plugin I validate all methods exist
and that each method has the correct number of required arguments, I
generally dont check argument name as my plugin systems all pass by
position instead of keyword. If the signature I am checking contains
*args it automatically passes the check. If the plugin fails the check
I dont load it.

On Thu, Sep 23, 2010 at 2:01 PM, Antoine Pitrou <solipsis at pitrou.net> wrote:
> Again, why do you want to check signatures? Do you not trust plugin
> authors to write plugins?

No, no I dont. I have had several plugin authors come to me
complaining that the plugin system is broken because it wont load
their plugin (even with a fairly detailed error message).


Dj Gilcrease
 ____
( |     \  o    ()   |  o  |`|
  |      |      /`\_/|      | |   ,__   ,_,   ,_,   __,    ,   ,_,
_|      | |    /      |  |   |/   /      /   |   |_/  /    |   / \_|_/
(/\___/  |/  /(__,/  |_/|__/\___/    |_/|__/\__/|_/\,/  |__/
         /|
         \|



More information about the Python-ideas mailing list