Using repr instead of str for parameters (not objects) for disambiguity
>>> for e in (0, "0", None, "None", 1.23, "1.23", [1,2], {"foo": "bar"}): ... print "%r" % e ... 0 '0' None 'None' 1.23 '1.23' [1, 2] {'foo': 'bar'}When %s is used to interpolate to string there could be a bit of ambiguity introduced.>>> for e in (0, "0", None, "None", 1.23, "1.23", [1,2], {"foo": "bar"}): ... print "%s" % e ... 0 0 None None 1.23 1.23 [1, 2] {'foo': 'bar'}
Comments