2008/4/22, Andrew McNabb <[EMAIL PROTECTED]>:
> Here's a really simple example:
>
> ("bash", "-c", 'FILE="/tmp/a b c"; cat "$FILE"')
>
> That's pretty simple as a list of arguments. But if you do it as a
> single string, you get:
>
> 'bash -c \'FILE="/tmp/a b c"; cat "$FILE"\''
>
> It can get much worse than this, especially if you need to use
> backslashes.
I think that force me to write a tuple or a list just in case I'd need
to write a string that uses simple and double quotes, or backslashes,
because it's "ugly", don't worth it.
What about growing the possibility of write a tuple/list *or* a
string, and if I have a string, just use it? You could say that
writing a plain string I incur in the risk of not enclosing the
parameters correctly at bash level, but note that you're still doing
that quote enclosing even in the tuple/list, and that Python normally
treats the programmer as an adult.
Regards,
--
. Facundo
Blog: http://www.taniquetil.com.ar/plog/
PyAr: http://www.python.org/ar/
_______________________________________________
Python-3000 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe:
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com