[issue20811] str.format for fixed width float can return a string longer than the maximum specified

2014-06-20 Thread Eric V. Smith
Changes by Eric V. Smith : -- assignee: -> eric.smith resolution: -> wont fix stage: -> resolved status: open -> closed ___ Python tracker ___

[issue20811] str.format for fixed width float can return a string longer than the maximum specified

2014-06-20 Thread Mark Lawrence
Mark Lawrence added the comment: I cannot see a fix that would keep everybody happy. Also allow for potential backward compatibility issues. Given that there are at least two if not more suggested workarounds I'm inclined to close as "wont fix". Opinions please. --

[issue20811] str.format for fixed width float can return a string longer than the maximum specified

2014-03-05 Thread Mark Dickinson
Mark Dickinson added the comment: > I think you always want the leading zero. Mark (Dickinson), what do yo think? Agreed that we want to keep the leading zero for normal uses. I wouldn't object to some way to opt out of the leading zero, but I'm not sure what that way (w/c)ould be. -

[issue20811] str.format for fixed width float can return a string longer than the maximum specified

2014-03-03 Thread aubmoon
aubmoon added the comment: We will add extending the float class as another possible work around or part of a work around. Our developers now have a few options to choose from. I am not sure which approach will be preferred. thanks for all of the quick replies. this was just an odd case that was

[issue20811] str.format for fixed width float can return a string longer than the maximum specified

2014-03-01 Thread Eric V. Smith
Eric V. Smith added the comment: I still think this is a special case that we won't "fix". And even if we did, you'd have to wait until 3.5. But instead of your solution, it might be easier to wrap your floats in a class that implements your version of format, based on float's format with some

[issue20811] str.format for fixed width float can return a string longer than the maximum specified

2014-03-01 Thread aubmoon
aubmoon added the comment: That is exactly what I tried first. It turns out in the particular case I have been working the 8th digit is needed for correct answers. The job is a port of a punch card FORTRAN system into something more modern. The catch is the system is a scientific application that

[issue20811] str.format for fixed width float can return a string longer than the maximum specified

2014-03-01 Thread Stefan Krah
Stefan Krah added the comment: aubmoon: Would it be a possibility just to use 'f' instead? >>> "{:+10.7f}".format(1.12345678) '+1.1234568' >>> "{:+10.7f}".format(0.12345678) '+0.1234568' -- nosy: +skrah ___ Python tracker

[issue20811] str.format for fixed width float can return a string longer than the maximum specified

2014-03-01 Thread aubmoon
aubmoon added the comment: Neither of those strictly meets the stated format. '0.12345678' is missing the + which is explicit in the format and '+0.1234567' does not have 8 decimal places. Only '+.12345678' has a length of 10, 8 decimal places, and the required sign. I realize this definitely an

[issue20811] str.format for fixed width float can return a string longer than the maximum specified

2014-03-01 Thread Mark Lawrence
Mark Lawrence added the comment: '0.12345678' or '+0.1234567' could both be considered equally valid. Who can say which is really The One True Way? :) -- nosy: +BreamoreBoy ___ Python tracker

[issue20811] str.format for fixed width float can return a string longer than the maximum specified

2014-03-01 Thread Eric V. Smith
Eric V. Smith added the comment: Oops, not sure how the nosy list got changed. Sorry about that. -- nosy: -anthonybaxter, barry, benjamin.peterson, eric.araujo, georg.brandl, gvanrossum, lemburg, loewis, tarek ___ Python tracker

[issue20811] str.format for fixed width float can return a string longer than the maximum specified

2014-03-01 Thread Eric V. Smith
Eric V. Smith added the comment: I think you always want the leading zero. Mark (Dickinson), what do yo think? And I also think changing it at this point would be problematic. -- nosy: +anthonybaxter, barry, benjamin.peterson, eric.araujo, georg.brandl, gvanrossum, lemburg, loewis, tar

[issue20811] str.format for fixed width float can return a string longer than the maximum specified

2014-03-01 Thread Mark Dickinson
Changes by Mark Dickinson : -- nosy: +mark.dickinson ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://ma

[issue20811] str.format for fixed width float can return a string longer than the maximum specified

2014-02-28 Thread Ned Deily
Ned Deily added the comment: OK, so the issue is that Python float literals in the range 0.0 < x < 1.0 can be spelled without a "0" before the decimal point but the built-in format method for floats appears to always output the leading "0" even in cases where doing so cause the string to unnec

[issue20811] str.format for fixed width float can return a string longer than the maximum specified

2014-02-28 Thread aubmoon
aubmoon added the comment: Admittedly maximum is not correct; however, minimum is not right either. The 10 is the desired (or target) width. Fixed width prints are commonly used with very legacy systems that die a painful death when fixed width strings are parsed by index and a field has spilled

[issue20811] str.format for fixed width float can return a string longer than the maximum specified

2014-02-28 Thread Ned Deily
Ned Deily added the comment: I think you are misunderstanding the meaning of the width component (e.g. the 10 in your example) of a format specification. As described in the documentation, width is a decimal integer defining the *minimum* field width, not the *maximum* field width. As necess

[issue20811] str.format for fixed width float can return a string longer than the maximum specified

2014-02-28 Thread aubmoon
New submission from aubmoon: "{:+10.8}".format(0.12345678) returns '+0.12345678' (11 chars) should return '+.12345678' (10 chars) -- messages: 212478 nosy: aubmoon priority: normal severity: normal status: open title: str.format for fixed width float can return a string longer than t