On Thu, Apr 27, 2017 at 2:19 AM, Tim Peters <tim.pet...@gmail.com> wrote:
> [boB Stepp <robertvst...@gmail.com>]
>
>>  I cannot find any discernible
>> difference between '%f' % <some floating point number> and '%F' %
>> <some floating point number>.  Is there any or do they duplicate
>> functionality?  If the latter, why are there two ways of doing the
>> same thing?
>
> They differ only in the capitalization of the strings produced for
> NaNs and infinities (math.nan and math.inf in Python 3).
>
>>>> "%f" % math.nan
> nan'
>>>> "%F" % math.nan
> NAN'
>>>> "%f" % math.inf
> inf'
>>>> "%F" % math.inf
> INF'

In context this can be inferred from the docs, but I think f/F should
indicate the casing difference just like e/E, g/G, and x/X do.

https://docs.python.org/3/library/stdtypes.html#printf-style-string-formatting
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to