which
Steve Holden
steve at holdenweb.com
Fri Feb 5 09:30:11 EST 2010
mk wrote:
>
> if isinstance(cmd, str):
> self.cmd = cmd.replace(r'${ADDR}',ip)
> else:
> self.cmd = cmd
>
> or
>
> self.cmd = cmd
> if isinstance(cmd, str):
> self.cmd = cmd.replace(r'${ADDR}',ip)
>
>
My own preference is for the latter, but I am sure you will find that
opinions are mixed on this. In recent versions of Python you might want
to take the possibility that cmd is Unicode into account by using
id isinstance(cmd, basestring):
regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
PyCon is coming! Atlanta, Feb 2010 http://us.pycon.org/
Holden Web LLC http://www.holdenweb.com/
UPCOMING EVENTS: http://holdenweb.eventbrite.com/
More information about the Python-list
mailing list