
report at bugs
May 9, 2008, 7:08 AM
Views: 269
Permalink
|
|
[issue2802] str.format() :n integer output
|
|
New submission from Mark Summerfield <mark[at]qtrac.eu>: In Py30a5 the 'n' format option is not v. useful for integers: >>> for x in range(8): print("{0:n} ".format(10**x), end="") 1 10 100 1,000 10,000 100,000 1e+06 1e+07 This is because it behaves like g once a number grows large. That makes sense for floats, but since Python has unlimited size integers there is currently no built-in way to get, 10**6 to output as 1,000,000 (or using whatever the user's locale-dependent separator is). (It is easy to write a suitable function for this, but it just seems that n is a bit of a teaser in this regard.) I think that n should stay the same for floats, but for integers should never switch to g, but just use as many separators as needed. ---------- messages: 66471 nosy: mark severity: normal status: open title: str.format() :n integer output type: feature request versions: Python 3.0 __________________________________ Tracker <report[at]bugs.python.org> <http://bugs.python.org/issue2802> __________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
|