[Tutor] Difference between %f and %F string formatting?

Tim Peters tim.peters at gmail.com
Wed Apr 26 23:51:09 EDT 2017


[boB Stepp <robertvstepp at gmail.com>, on %i/%d and %f/%F]
> Hmm.  I'm surprised this slight distinction was worth keeping two
> format codes that otherwise do the same thing.  Is there an actual
> need for these due to Python being implemented behind the scenes in C?

The implementation is irrelevant to this.  What is relevant:  Python
took its format-string semantics from C.  Because of that alone, any
deviation from what the C docs say has to have very strong
justification.  "It's just like C" saves us from needing to write our
own mountains of tutorials and reference material.   The C world -
which has way more people and money supporting it - did that for us.

Recall that I answered your original question by pointing to an
article on the web about how this stuff works in C ;-)


More information about the Tutor mailing list