A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2008-November/083637.html below:

[Python-Dev] format specification mini-language docs...

[Python-Dev] format specification mini-language docs... [Python-Dev] format specification mini-language docs...Dino Viehland dinov at microsoft.com
Sat Nov 22 01:51:50 CET 2008
Ok, now I'm implementing __format__ support for IronPython.  The format spec mini-language docs say that a presentation type of None is the same as 'g' for floating point / decimal values.  But these two formats seem to differ based upon how they handle whole numbers:

>>> 2.0.__format__('')
'2.0'
>>> 2.0.__format__('g')
'2'

The docs also say that 'g' prints it as fixed point unless the number is too large.  But the fixed point format differs from what 'f' would print.  I guess it didn't say they'd both print it as fixed point w/ a precision of 6 or anything but it seems a little unclear.

>>> 2.0.__format__('g')
'2'
>>> 2.0.__format__('f')
'2.000000'

Finally providing any sign character seems to cause +1.0#INF and friends to be returned instead of inf as is documented:

>>> 10e667.__format__('+')
'+1.0#INF'
>>> 10e667.__format__('')
'inf'


Are these just doc bugs?  The inf issue is the only one that seems particularly weird to me.
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4