Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Python: Bugs
[issue2802] str.format() :n integer output
 

Index | Next | Previous | View Flat


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

Subject User Time
[issue2802] str.format() :n integer output report at bugs May 9, 2008, 7:08 AM
    [issue2802] str.format() :n integer output report at bugs May 9, 2008, 7:23 AM
    [issue2802] str.format() :n integer output report at bugs May 9, 2008, 7:42 AM
    [issue2802] str.format() :n integer output report at bugs May 9, 2008, 7:44 AM
    [issue2802] str.format() :n integer output report at bugs May 9, 2008, 7:55 AM
    [issue2802] str.format() :n integer output report at bugs May 9, 2008, 7:55 AM
    [issue2802] str.format() :n integer output report at bugs May 9, 2008, 8:12 AM
    [issue2802] str.format() :n integer output report at bugs May 11, 2008, 12:53 PM
    [issue2802] str.format() :n integer output report at bugs May 11, 2008, 2:17 PM

  Index | Next | Previous | View Flat
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.