3 ms·
This is really a complaint about the Python docs. The poster is using a book that makes you look for info that ought to be in the book in a convenient table. I
by Animats 10y ago
This is really a complaint about the Python docs. The poster is using a book that makes you look for info that ought to be in the book in a convenient table.
If you search for "Python formatting", you get to [1] which doesn't list the "%r" format effector. Neither does [2], which is the same document for Python 3.6. See, on that page, "Form specification mini-language":
format_spec ::= [[fill]align][sign][#][0][width][,][.precision][type]
fill ::= <any character>
align ::= "<" | ">" | "=" | "^"
sign ::= "+" | "-" | " "
width ::= integer
precision ::= integer
type ::= "b" | "c" | "d" | "e" | "E" | "f" | "F" | "g" | "G" | "n" | "o" | "s" | "x" | "X" | "%"
Not seeing an "r" in there. There's an example further down on the page which uses "%r", but the syntax description and tables do not mention it.
Stack Overflow isn't the one to blame here.
[1] https://docs.python.org/2/library/string.html https://docs.python.org/2/library/string.html
[2] https://docs.python.org/dev/library/string.html#formatspec https://docs.python.org/dev/library/string.html#formatspec
- exolymph 10y agoMy point was more about the attitude toward beginners than the actual accessibility of the information, but you're right that Python's docs could be more user-friendly.