[Python-3000] ABC's, Roles, etc

Phillip J. Eby pje at telecommunity.com
Thu May 10 03:30:22 CEST 2007


At 06:11 PM 5/9/2007 -0400, Benji York wrote:
>Phillip J. Eby wrote:
>>If you don't count in-house "enterprise" operations and shops like 
>>Google, Yahoo, et al., the development of Zope is certainly one of 
>>the largest (if not the very largest) Python project.  It's 
>>understandable that LBYL is desirable in that environment.  On the 
>>other hand, such large projects in Python are pretty darn rare.
>
>By way of clarification: Even in the large Zope 3 projects I work on 
>(which obviously use zope.interface), we virtually never use 
>interfaces for LBYL (just as Zope 3 itself rarely does).

Yet, this is precisely what Jeff is claiming zope.interface is 
useful/desirable *for*, and Jim Fulton has also been quite clear that 
LBYL is its very raison d'etre.

But of course, as you point out below, that's not necessarily what 
most zope.interface users actually *do* with it.  :)


>Instead, we either assume something implements a (little "i") 
>interface and act as such (never invoking the interface machinery, 
>the way most people write Python), or we use adaptation to ask for 
>something that implements a particular (big "I") Interface (but even 
>there no verification is done).
>
>My point is, people generally use zope.interface Interfaces as 
>documentation and names for particular behavior/API, not as an LBYL 
>enforcement mechanism.

And thus, for all of the use cases you just described, the minimal 
PEP 3124 Interface implementation should do just fine, yes?  Indeed, 
ABCs would work for those use cases too, if you didn't need 
adaptation.  Or am I missing something?



More information about the Python-3000 mailing list