multiline snippets with triple quotes
Peter Hansen
peter at engcorp.com
Thu Aug 12 15:37:15 EDT 2004
Christoph Zwerschke wrote:
> So, what would be the pythonic way to implement such multiline snippets?
Define them externally to that code block. Either put
them above the function, or at the top of the module,
or have them read from an external file, with the
best approach being dependent on the precise situation
at hand. For example, if you have only one or two
such things, just use parentheses and single quotes
instead of the triple quoting, while if you have a
bunch of them but don't want to read them from a file,
put them in a separate module and just import and
reference them as required.
-Peter
More information about the Python-list
mailing list