[Grok-dev] Re: Grok Widgets / Fields

Brandon Craig Rhodes brandon at rhodesmill.org
Sat Jan 12 12:19:58 EST 2008


Martijn Faassen <faassen at startifact.com> writes:

> Instead the simplest fix is to do:
>
> l = []
> l.append('my stuff')
> l.append('more stuff')
> return ''.join(l)

There was (still is?) a neat Python module named "Quixote" that
brilliantly had a type of function called a "template" that
concatenated and returned the string values returned by every bare
expression in its code.  Thus:

template t(n):
    'Hello, world, the number is '
    str(n)
    '.'

t(3)

would result in "Hello, world, the number is 3."  It made the idiom of
first listing several strings, then doing the join() all at once, very
convenient.

-- 
Brandon Craig Rhodes   brandon at rhodesmill.org   http://rhodesmill.org/brandon


More information about the Grok-dev mailing list