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.
_______________________________________________
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com