which
John Posner
jjposner at optimum.net
Fri Feb 5 11:51:31 EST 2010
On 2/5/2010 11:26 AM, Gerald Britton wrote:
> sure, but it will fit nicely on one line if you like
>
> On Fri, Feb 5, 2010 at 11:22 AM, John Posner<jjposner at optimum.net> wrote:
>
>> 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
>>
>>
>>
>>
>
>
>
Did you mean to take this off-list? Also, I'm contractually obligated
to admonish you not to "top post".
At any rate, I proposed the 3-line format specifically because it
separates the data values from the if-then-else machinery, making it
easier (for me) to read. But there was considerable resistance to
spending so much vertical space in the source code.
-John
More information about the Python-list
mailing list