which

John Posner jjposner at optimum.net
Fri Feb 5 11:22:56 EST 2010


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





More information about the Python-list mailing list