[Zope] making 'printed' = ''

Evan Simpson evan@4-am.com
Wed, 12 Dec 2001 18:40:24 -0500


Christopher N. Deckard wrote:

> Is it possible to do something like this:
> 
>   printed = ''


Nope. 'printed' is a magical variable created by Python-based Scripts, and 
they refuse to contemplate using it other than in a read-only context.

You can accomplish what you want with the more explicit:

from string import join
snippets = []
pr = snippets.append
pr('a line')
pr('another line')
...
pr('last line')
text = join(snippets, '\n') + '\n'

Cheers,

Evan @ Zope