Added adminition against using %d.

This commit is contained in:
Jeremy Fincher 2003-10-29 22:04:57 +00:00
parent afc74b96f0
commit e5e507f3d9

View File

@ -57,9 +57,14 @@ Whenever joining more than two strings, use string interpolation, not addition:
This has to do with efficiency; the intermediate string x+y is made (and thus This has to do with efficiency; the intermediate string x+y is made (and thus
copied) before x+y+z is made, so it's less efficient. copied) before x+y+z is made, so it's less efficient.
When writing strings that have formatting characters in them, don't
use anything but %s unless you absolutely must. In particular, %d
should never be used, it's less general than %s and serves no useful
purpose.
Use the debug module to its fullest; when you need to print some values to Use the debug module to its fullest; when you need to print some values to
debug, use debug.printf to do so, and leave those print statements in the code debug, use debug.printf to do so, and leave those print statements in the code
(perhaps commented out) so they can later be re-enabled. Remember that once (commented out) so they can later be re-enabled. Remember that once
code is buggy, it tends to have more bugs, and you'll probably need those print code is buggy, it tends to have more bugs, and you'll probably need those print
statements again. statements again.