[Zope-CMF] Re: [CMF 2.1] FSPageTemplate & Unicode

Tres Seaver tseaver at palladion.com
Tue Jan 9 16:24:55 EST 2007


-----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          tseaver at palladion.com
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-----



More information about the Zope-CMF mailing list