[Grok-dev] Re: you can comma separate directives
Christian Theune
ct at gocept.com
Fri May 2 04:48:12 EDT 2008
On Fri, May 02, 2008 at 10:07:59AM +0200, Philipp von Weitershausen wrote:
> Brandon Craig Rhodes wrote:
>> What fun! It just occurred to be that, because directives just
>> introspect the stack, but don't return any useful value "into" the
>> class-declaration code block they're part of, you can stack them on a
>> single line with commas:
>>
>> class Fish(grok.View):
>> grok.context(MyApp), grok.name('fish')
>>
>> That will be helpful the next time a stack of directives threatens to
>> push my actual code down off of the bottom of the screen.
>
> You could've also used a semicolon :). But yeah, it's pretty cool,
> albeit a bit confusing...
Other weird-looking possibilities:
directives = grok.context(MyApp) = grok.name('fish')
grok.context(MyApp) + grok.name('fish')
Hooray for result-less side-effect-based programming. :)
Christian
--
gocept gmbh & co. kg - forsterstrasse 29 - 06112 halle (saale) - germany
www.gocept.com - ct at gocept.com - phone +49 345 122 9889 7 -
fax +49 345 122 9889 1 - zope and plone consulting and development
More information about the Grok-dev
mailing list