ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> types-sig
types-sig
[Types-sig] Re: PRE-PROPOSAL: Python Interfaces
by Jim Fulton other posts by this author
Nov 23 1998 10:32PM messages near this date
[Types-sig] Re: PRE-PROPOSAL: Python Interfaces | Re: [Types-sig] Re: PRE-PROPOSAL: Python Interfaces
This discussion should move to the types-sig, types-sig@[...].org,
http://www.python.org/sigs/types-sig/.  I am cross posting to the
types sig.  Replies to this message should be posted to
types-sig@[...].org and *not* to comp.lang.python.

Gordon McMillan wrote:
>  
>  I don't object, but I worry. For example, the "sequence protocol" is
>  a very fuzzy thing.

Yes it is.  It should be factored.
 
>  If you start with the abstract sequence protocol (as defined by the C
>  API), only List is an implementation of which B. Meyer would approve,
>  (SetItem is in the abstract interface, for example).

Yup.

>  OK, so lets pretend that's cleaned up. Now we're getting methods on
>  List so it can be treated like a Stack. Stack is certainly not
>  another name for List, nor for Sequence (whatever that means). It's
>  another protocol, right?

Yes.

>  But it's one that is automatically
>  implemented if you implement the List protocol.

Right.  If you bothered to define "List" protocol as
the methods supported by list, you might very well 
make stack a base interface.
 
>  How about FileInput? That's a sequenceish protocol. A read-only,
>  forward-only, sequential-only sequence. How do we (sensibly and
>  comprehensibly) capture the fact that most sequenceish protocols will
>  suffice where a FileInput protocol is required, with the exception of
>  those stack-ish style sequences?

I don't know what FileInput is.
 
>  In fact (as Barry was supposed to point out at the conference for me,
>  harrumph, harrumph), the set of all interfaces / protocols is the set
>  of all subsets of the set of all signatures - without taking behavior
>  into account. That is, the set of all interfaces has a cardinality
>  that I don't particularly want to contemplate.

But one would not bother to enumerate all possible interfaces.

>  At the moment "sequence protocol" means 2 different things. It means
>  Py_SequenceCheck(o) == TRUE (which I hope the type / class
>  unification fixes),

No.  This is a purely implementation check.  It doesn't, for example, 
capture instances that implement the sequence protocol.

>  and it means that if you squint a little and wave
>  your hands alot, this thing could be considered a sequence. My worry
>  is that if you attempt to make the latter definition more precise,
>  you in fact increase complexity.

Interfaces give you the ability to express more.  In a sense this
adds complexity, but it also lends order to existing complexity
(e.g., as you point out, Tuples are sequences, sort of)
 
Jim

--
Jim Fulton           mailto:jim@[...].com
Technical Director   (888) 344-4332              Python Powered!
Digital Creations    http://www.digicool.com     http://www.python.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.
Thread:
Jim Fulton
Gordon McMillan

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved