On 2/5/2010 11:06 AM, Gerald Britton wrote:
[snip]Last August [1], I offered this alternative: self.cmd = (cmd.replace(r'${ADDR}',ip) if isinstance(cmd, str) else cmd) But it didn't get much love in this forum!I'd probably go for that one as well though I might consider removing the outer parentheses.
Agreed ... except that you *need* the outer parentheses if the statement occupies multiple source lines.
-John -- http://mail.python.org/mailman/listinfo/python-list