[Zope-CMF] Re: [dev] CMFSetup: proposal for improving handlers

Tres Seaver tseaver at zope.com
Fri Dec 17 10:32:23 EST 2004


yuppie wrote:
> Dieter Maurer wrote:
> 
>> yuppie wrote at 2004-12-13 09:50 +0100:
>>
>>> I started my prototype with explicit dictionary keys like here:
>>>
>>>    { 'permission': {'key': 'permissions', 'default': ()} }
>>>
>>> But I replaced them later with constants imported from one place to 
>>> catch typos easily.
>>
>>
>>
>> For an example, it is better to use the string constants literally
>> rather than hiding them behind constants.
>>
> 
> Why? The pattern I chose is used in many places. And it makes sure you 
> get an error if you misspelled a name.
> 
> The values behind the constants are meaningless:
> 
>     CONVERTER, DEFAULT, KEY = range(3)

I think Dieter's "for an example" means, "when sketching a fragment of 
code for use as an example".  I prefer your "use manifest constant" 
practice for production code.

Tres.
-- 
===============================================================
Tres Seaver                                tseaver at zope.com
Zope Corporation      "Zope Dealers"       http://www.zope.com



More information about the Zope-CMF mailing list