classes and interfaces

Paul McGuire ptmcg at austin.rr._bogus_.com
Tue Jun 27 14:48:57 CEST 2006


<s99999999s2003 at yahoo.com> wrote in message
news:1151401318.703216.288850 at x69g2000cwx.googlegroups.com...
> hi
> i come from a non OO environment. now i am learning about classes. can
> i ask, in JAva, there are things like interface. eg
> public interface someinterface {
>    public somemethod ();
>    ....
>    ...
> }
>
> In python , how to implement interface like the above? is it just
> define a class??
>
> class someinterface:
>      def somemethod: blah....
>
> thanks
>

This question crops up every week or two on this list.  (This is a healthy
indicator of people looking to map their Java learnings to Python.  Some of
the best programming knowledge I've gained has come from comparing features
among different languages, and understanding their respective
purposes/strengths/shortcomings.  In this case, presence of interfaces in
Java)  Here are some recent threads that cover this topic:

http://groups.google.com/group/comp.lang.python/browse_frm/thread/d5da229b0050725d/47411c8c9322821c?q=java+interface&rnum=20#47411c8c9322821c

http://groups.google.com/group/comp.lang.python/browse_frm/thread/d5da229b0050725d/47411c8c9322821c?q=java+interface&rnum=20#47411c8c9322821c


Is this in the FAQ?  Hmm, these two FAQ's may be related to your question
(although you have to know what you're looking for to recognize them):
http://www.python.org/doc/faq/general/#how-do-you-specify-and-enforce-an-interface-spec-in-python
http://www.python.org/doc/faq/programming/#is-there-a-tool-to-help-find-bugs-or-perform-static-analysis


Lastly, you should look into





More information about the Python-list mailing list