No subject


Thu Jan 6 01:15:04 PST 2011


replacing multi-word elements in the command as denoted by []
characters with the positional arguments, if provided, and if not, to
strip them out completely:

          [section]
          key2=
              cmd1 []
              cmd2 [{item2} \
                   other]

Here, cmd2 will either be "cmd2 POSARGS", "cmd2", or "cmd2 item2value"
depending on substitutions

So, the question is, then, is this a good design for command
substitution? \[.*\] is a VERY greedy way to replace text in a
command, especially given that there's no way to escape these strings
as it stands. Also, any escaping scheme is going to be subject to some
potentially awful nested escaping issues, depending on how the command
is executed. That might not be a problem -- I suspect that the command
is executed using subprocess, so shell escaping is moot -- but it
might be a hard problem to solve.

For my part, I'd suggest changing the substitution marker to something
less likely to ever be found in a command line; '{{}}' or '<<<>>>' or
something like it, or to add a way to escape them.

I'd like to contribute a fix to this, but first I need to know what
the right fix should be. Thoughts?

-- 
Chris R.
======
Not to be taken literally, internally, or seriously.
Twitter: http://twitter.com/offby1



More information about the testing-in-python mailing list