[Zope3-dev] Re: Field constructors

Gary Poster gary at modernsongs.com
Wed Jan 14 12:54:28 EST 2004



Casey Duncan wrote:
> Philipp von Weitershausen <philipp at weitershausen.de> wrote:
>>Jim Fulton wrote:
>>> > Ah, well, it's not a big deal really. It's just that you write::
>>> >
>>> >            title = TextLine(
>>> >                __doc__ =
>>> >                """Menu item title
>>> >
>>> >                The title provides the basic label for the menu
>>> >                item.""",
>>> >                required=True.
>>> >                )
>>> >
>>> > while I would prefer the schema convention::
>>> >
>>> >            title = TextLine(
>>> >                title=u"Menu item title",
>>> >                description=u"""The title provides the basic label
>>> >                for the menu item.""",
>>> >                required=True.
>>> >                )
>>>
>>>They are equivalent.
...
> 
>>Whatever happened to explicit is better than implicit? People will
>>ask: why that magic? (see i18n issue below).
> 
> 
> Yeah, this smells kinda bad. I think it's a slippery slope. Pretty soon
> we'll be writing full ReST documents in __doc__ and expecting the right
> attributes to automagically parse out of it ;^). Seriously though I
> think it sets a bad precident, are these really docstrings?

FWIW, I'm also in the "it smells bad to me" camp.  That is, I find the 
doc string unnecessarily magic, and the "title" and "description" 
explicit arguments to be simple and clear.  I'd rather get rid of the 
doc string approach entirely (explicit is better than implicit, there's 
only one way to do it, and all that), myself.

Gary



More information about the Zope3-dev mailing list