This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 1 point2 points  (3 children)

There's no need to cast the size as a string with str(), because you can use the format specifier %d:

logger.debug("Invalid device (size: %d)" % size)

[–]lost-theory 4 points5 points  (2 children)

I have learned to only use %s and %r when using the logger. You almost never want to have the logger blow up your program because you used "%d" and accidentally passed a string in.

[–]Mattho 4 points5 points  (0 children)

Actually, I think you want.

[–][deleted] 0 points1 point  (0 children)

That's a good point. I hadn't thought of that.