"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 > -- it's a wart: > > try: > options, args = getopt.getopt(sys.argv[1:], "cf:s") > except getopt.GetoptError: > print """Usage: dostuff <options> > > Options: > -c - blah blah > -f <filename> - do stuff with file "filename" > -s - more blah""" > > sys.exit(1) > > This really makes the code hard to read, as the indentation is all > mixed up (visually). > > I have written a patch that changes the way triple-quoted strings are > scanned so that leading whitespace is ignored in much the same way > that pep 257 handles it for docstrings. Largely this was for a > learning experience in hacking the parser, but it would be very nice > IMO if something of this sort could be implemented in a future version > of Python. To this end, I have sketched out a draft PEP (which was > itself a good learning exercise in thinking out the issues of such a > change). Should I post it here for discussion? > > Andrew > _______________________________________________ > Python-Dev mailing list > Python-Dev@python.org > http://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: > http://mail.python.org/mailman/options/python-dev/python-python-dev%40m.gmane.org >
_______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com