Hash: SHA1

Philipp von Weitershausen wrote:
> Chris Withers wrote:
>> Christian Theune wrote:
>>> The problem you have is to provide a specification for the 'str' 
>>> interface.
>> There are a couple of problems here...
>> 1. str is both a "function" and a "class"
> Nope. It's a class since Python 2.2.
>> 2. I was to register the "function" str as an adapter for, say, the 
>> "class" int to the "class" str, so there's not factory for the adapter, 
>> since it's a function
>>> Let's create a marker interface that promises everything that 'str' does:
>>> class IString(zope.interface.Interface):
>>>     """A marker for the 'str' interface."""
>> As discussed elsewhere, you shouldn't need the marker interface, as you 
>> can adapt classes.
> Right, as an *input* of the adaption it's ok just to specify a class. 
> But the output obviously always has to be specified by an interface. 
> Otherwise the whole point of using of adaption is perverted...

Like adapting to None?  Using adaptation to look up "value factories" is
not any weirder than using it to look up event subscribers whose return
values are always discarded.

Thnk of cataloguing / indexing use cases:  adapting the catalogued
object to a string value (or tuple, or whatever) using named adapters is
a very "natural" way to make indexing pluggable:  what is *unnatural*
(or at least a "dead chicken") is the requirement to adapt to an
'IString', when what I really want is a 'str'.

- --
Tres Seaver          +1 202-558-7113          [EMAIL PROTECTED]
Palladion Software   "Excellence by Design"    http://palladion.com
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org


Zope3-dev mailing list
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com

Reply via email to