Steve and Jeff,

Thanks for the great explanations :-)

Now I'm curious about Python 2.2 and classes with static methods...

cheers,

Chris

Jeffrey P Shell wrote:
> 
> On 1/28/02 8:17 AM, "Chris Withers" <[EMAIL PROTECTED]> wrote:
> 
> > Jeffrey P Shell wrote:
> >>
> >> On 1/27/02 11:25 AM, "Steve Alexander" <[EMAIL PROTECTED]> wrote:
> >>
> >>> Hi folks,
> >>>
> >>> When I define an Interface, are the methods of the interface supposed to
> >>> have "self" as the first argument?
> >>
> >> No.
> >
> > Can you expand on this a little?
> >
> > It doesn't make sense to me to exclude 'self'...
> 
> Jim [Fulton] explained it to me once.  He can explain it better than I can.
> But think of it this way -- theoretically, an interface can be implemented
> by a folder full of Python scripts as [relatively] easily as it can be
> implemented by a class.  Should you then include all of the binding options
> (context, container, etc)?
> 
> Or, if you were defining the interface in IDL (mmm,
> almost-avoiding-redundancy through acronyms!) with the target language being
> Python, would you include self?
> 
> An interface defines a contract on the usage of an object/component; it's
> not necessarily a specification on how to implement it.  The concept of
> 'self' as the first argument for instance methods is a product of
> implementing in a Python class (not to mention that 'self' is not a required
> name, just an extremely common convention.  You could use 'this' just as
> easily).
> 
> The big theory behind most component models is that the implementation
> shouldn't matter so long as certain interfaces are satisfied.  And the
> following simple interface could be satisfied a number of ways in Zope
> already - by a normal Python class implementation; by a folder with a Python
> Script or External Method; by a ZClass with the same; or (in Python 2.2) by
> a class with a static method (which would have no 'self').
> 
> class ISubscriber(Base):
>     """ Subscriber base interface """
>     def EventService_inform(event):
>         """ Informs the subscriber that the event has occurred """
> 
> --
> Jeffrey P Shell
> www.cuemedia.com

_______________________________________________
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )

Reply via email to