Interfaces (Re: Perl is worse! (was: Python is Wierd!))

Jim Fulton jim at digicool.com
Tue Aug 1 09:59:44 EDT 2000


Corran Webster wrote:
> 
> In article <oogg5.2633$6E.681244 at ptah.visi.com>, ge at nowhere.none (Grant
> Edwards) wrote:
> 
> > In article <Pine.GSO.4.10.10007281010300.4194-100000 at sundial>, Moshe
> > Zadka wrote:
> > >On Fri, 28 Jul 2000, Grant Edwards wrote:
> > >
> > >> Is 'sequence mapping' for list() an tuple() defined the same as
> > >> for the 'for' statement: it has a get_item(i) method that
> > >> returns either a value or raises an exception?
> > >
> > >Actually, I think these two want an __len__ method too.
> >
> > At this point somebody is required to complain about the
> > vagueness of Python interfaces, and if there was some sort of
> > language facility for defining the interface for a "sequence"
> > then I wouldn't have had to ask that question.
> >
> > Since it's Friday, and the person assigned to the task of
> > complaining about interfaces is off today, I've filled in
> > temporarily.  But I'm goign golfing at noon, so if you want to
> > argue about it you'll have to make an appointment with the
> > regular staff on Monday.  Since I'm just filling in, all I'd be
> > able to provide is rote contridiction -- which we all know
> > isn't a real argument...
> 
> Here's a little something that I've been fiddling with in my spare time
> for the past little while.  It's an interface definition mechanism which
> uses metaclasses to allow a heirarchy of interfaces (somewhat like the
> exception heirarchy).  See the docstrings for details on how to use it.
> 
> Warning:  This uses metaclasses, so your head may explode if you try to
> follow what is going on here.
> 
> Corran
> 
(interesting interface implementation skipped)

Have you looked at:

http://www.zope.org/Members/jim/PythonInterfaces/Summary

This looks very similar to what you've put together.
We are beginning to apply this in Zope.

Jim

--
Jim Fulton           mailto:jim at digicool.com   Python Powered!        
Technical Director   (888) 344-4332            http://www.python.org  
Digital Creations    http://www.digicool.com   http://www.zope.org    

Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email
address may not be added to any commercial mail list with out my
permission.  Violation of my privacy with advertising or SPAM will
result in a suit for a MINIMUM of $500 damages/incident, $1500 for
repeats.



More information about the Python-list mailing list