"Andrew Durdin" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> In general, I find triple-quoted strings to be very handy,
> particularly for standalone scripts. However, the fact that they have
> to be written in the left-hand column to avoid leading whitespace
> really grates, particularly when they're nested within a block or two
At present I think I would do
usage_text = '''\
text how I want it
'''
perhaps in global context or at top of function and then
> try:
> options, args = getopt.getopt(sys.argv[1:], "cf:s")
> except getopt.GetoptError:
print usage_text
I long ago found it advantageous to pull message texts from scattered
locations into a central place where easier to find and edit. I also make
program logic easier to read without a long block in the way. YMMV
Doc strings, first meant for the code reader, need to be where they are.
They also come before the code itself, so don't interfere.
> -- it's a wart:
That is rather extreme, and is definitely an opinion.
> I have written a patch that changes the way triple-quoted strings are
> scanned so that leading whitespace is ignored.
And what if I want the leading whitespace left just the way I carefully put
it? And what of existing code dependent on literals being as literal as
they currently are? I think the soonest this could be considered is Python
3.0.
Terry J. Reedy
_______________________________________________
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com