On 22/04/2008, Facundo Batista <[EMAIL PROTECTED]> wrote: > 2008/4/22, Andrew McNabb <[EMAIL PROTECTED]>: > > > > That's the best thing about subprocess. Whenever I've used APIs that > > accept a single string instead of list of arguments, I've quickly > > descended into quoting hell. > > > I don't understand why, could you please provide me one example or two? > > Thank you! > > > -- > . Facundo
Well, here's a real method I ran into a while back - with .replace(origname, 'example'). Written by a perfectly able python programmer in publicly released code: def example_command(self, command, args): args = ' '.join("'%s'" % arg for arg in args) return 'example --example-dir=%s %s %s' % (self.example_dir, command, args) What's wrong with it? Well, if you use unix, with no spaces in directories and legal 'quote', you'll probably say "nothing". String interpolating command calls makes for unnecessarily non-portable code. Now, if subprocess could only start (optionally) taking unicode arguments so I could actually get at my whole filesystem through it... Martin _______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com