[Tutor] intefaces in python

Amit Sethi amit.pureenergy at gmail.com
Mon Jun 29 11:39:18 CEST 2009


Well I want to implement plug-in like mechanism for an application . I want
to define some minimum functions that any body writing a plugin has to
implement. For that i thought an interface would be best because in a
scenario where the function is not implemented some kind of error would
occur. I would love to hear if you think their is a better way to achieve
this

On Mon, Jun 29, 2009 at 2:49 PM, Alan Gauld <alan.gauld at btinternet.com>wrote:

> "Amit Sethi" <amit.pureenergy at gmail.com> wrote
>
>> class MyInterface(object):
>>  doSomething(line):
>>       raise NotImplementedError
>>  doSomethingElse(line):
>>      raise NotImplementedError
>>
>> I think that is exactly the kind of structure i was looking for ...
>>
>
> As a matter of interest, why? What do you anticipate using this for?
> I have found a few cases where abstract interfaces are useful but they are
> very few and far between.
>
> --
> Alan Gauld
> Author of the Learn to Program web site
> http://www.alan-g.me.uk/
>
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>



-- 
A-M-I-T S|S
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20090629/b1f353ba/attachment.htm>


More information about the Tutor mailing list