[Zope3-dev] Re: adapter registration question

whit d.w.morriss at gmail.com
Mon Nov 13 14:48:45 EST 2006


Tres Seaver wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Philipp von Weitershausen wrote:
>> Tres Seaver wrote:
> 
> <snip>
> 
>>> 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'.
>> Well, part of Python idea is duck typing and requiring that you get a 
>> 'str' may be too much. Perhaps you would really only like to get 
>> something that quacks like str. OTOH, perhaps you absolutely want a 
>> 'str' and that use case should perhaps be allowed...
> 
> Heh, in this case using 'IString' is really a "trussed duck" (duck
> typing with B&D) ;)  Python's duck typing breaks down with strings,
> because they can by "quack tested" like sequences, but you almost
> *never* want to treat them the same way as other sequences, so you end
> up with 'isinstance(obj, basestr)' tests to prevent handling them that way.
> 

hello RuleDispatch...

-w




More information about the Zope3-dev mailing list