Multiple equates
Cameron Laird
claird at lairds.us
Wed Dec 3 10:47:54 EST 2008
More information about the Python-list mailing list
Wed Dec 3 10:47:54 EST 2008
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
In article <gh5q7c$r1e$3 at lust.ihug.co.nz>, Lawrence D'Oliveiro <ldo at geek-central.gen.new_zealand> wrote: >In message <mg2i06-vql.ln1 at lairds.us>, Cameron Laird wrote: > >> def shell_escape(Arg) : >> """returns Arg suitably escaped for use as a command-line argument >> to Bash.""" >> >> pattern = r"[\<\>\"\'\|\&\$\#\;\(\)\[\]\{\}\`\!\~\ \\]" >> def f1(Match): >> return "\\" + Match.group(0) >> return re.sub(pattern, f1, Arg) >> # Need to catch anything that might be meaningful to shell >> #end shell_escape > >So why is that better? I'm very lost, now. As best I can remember and/or reconstruct this conversation, the form above is adequately readable and does not involve lambda (and fits in eighty-column lines, and has a few even more mundane features). There's a realm within Pythonia that favors lambdalessness. I think that's all I'm claiming at this point.
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list