-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Martin Aspeli wrote:
> Dieter Maurer wrote:
> 
>>>  - It's an explicit declaration of support
>> As is the definition of "__of__".
> 
> Well, not in a formal sense. I could have some non-Zope python object 
> that I wanted to register as a local utility (to override a global one, 
> say) that could have __of__() for some other reason.

That would be an "empty set":  '__of__' is a slot which only Zope's
ExtensionClasses define;  it isn't used by "non-Zope python objects".


> IAcquirer is an explicit, formalised statement of support for some 
> particular behaviour.

It is a latecomer to the game, and doesn't seem "superior" to a "duck
typing" check, at least to me.

> I doubt it matters in this case (I'd guess __of__() is not a very common 
> method name outside Zope, and this would be pretty localised code), but 
> in general, having code be conditional on hasattr() something can lead 
> to spaghetti code and unintended side effects.

Checking for an '__of__' on an about-to-be-returned attribute is
*exactly* what ExtensionClass already does inside an attribute access;
I'd say let's follow suit, rather than invent an otherwise-irrelevant
contract.

Or, to paraphrase the Beatles:  "All you need is __of__ ... DAH dah,
dadda dum...  __of__ is all you need."


Tres.
- --
===================================================================
Tres Seaver          +1 540-429-0999          [EMAIL PROTECTED]
Palladion Software   "Excellence by Design"    http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFpAgn+gerLs4ltQ4RAhyeAJ9vdnZ+QGCl2tYkuNr2YHwGirFCPACgtx/k
t78I+hbABDDajG0a6C5dHqY=
=lTvK
-----END PGP SIGNATURE-----

_______________________________________________
Zope-CMF maillist  -  Zope-CMF@lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

See http://collector.zope.org/CMF for bug reports and feature requests

Reply via email to