[issue5237] Allow auto-numbered replacement fields in str.format() strings

2009-03-09 Thread Eric Smith
Eric Smith added the comment: Also note that this patch causes a few tests to fail, since they're trying to ensure that '{}'.format will fail. If we go forward I'll address that too, of course. -- message_count: 15.0 -> 16.0 ___

[issue5481] Expand Decimal.__format__() support to include "n"

2009-03-13 Thread Eric Smith
Changes by Eric Smith : -- nosy: +eric.smith ___ Python tracker <http://bugs.python.org/issue5481> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue5237] Allow auto-numbered replacement fields in str.format() strings

2009-03-13 Thread Eric Smith
Eric Smith added the comment: I'm thinking of allowing you to mix keywords and auto-numbering, but not manual numbering and auto-numbering. This would be so we could do: >>> '{:{fmt}} {:{fmt}}'.format(3.1415, 2.71828, fmt='1.4f') 'pi=3.1415 e=2.7183'

[issue5237] Allow auto-numbered replacement fields in str.format() strings

2009-03-13 Thread Eric Smith
Eric Smith added the comment: Copy and paste error. That should be: >>> 'pi={:{fmt}} e={:{fmt}}'.format(3.1415, 2.71828, fmt='1.4f') 'pi=3.1415 e=2.7183' -- ___ Python tra

[issue5237] Allow auto-numbered replacement fields in str.format() strings

2009-03-13 Thread Eric Smith
Eric Smith added the comment: Should string.Format also support auto-numbering? It seems like it should, but I'm not convinced it's possible without modifying the signatures to the public methods, in particular get_field(). The design of string.Format doesn't support state tha

[issue5237] Allow auto-numbered replacement fields in str.format() strings

2009-03-13 Thread Eric Smith
Eric Smith added the comment: I believe this patch is complete. I need to add tests and documentation, but the code itself should be finished. Here's the normal case: >>> '{} {}'.format('test', 0) 'test 0' It also handles error checking: >>&

[issue5237] Allow auto-numbered replacement fields in str.format() strings

2009-03-13 Thread Eric Smith
Eric Smith added the comment: About '{:{fmt}}' and other wacky combinations, like '{.__doc__}': It's much easier and cleaner in the code to allow these cases than it would be to disallow them. And I rather like the '{:{fmt}}' example! I suggest leaving th

[issue5237] Allow auto-numbered replacement fields in str.format() strings

2009-03-14 Thread Eric Smith
Changes by Eric Smith : Removed file: http://bugs.python.org/file13283/half-baked-not-for-real-use.patch ___ Python tracker <http://bugs.python.org/issue5237> ___ ___

[issue5237] Allow auto-numbered replacement fields in str.format() strings

2009-03-14 Thread Eric Smith
Eric Smith added the comment: Committed: r70364 (trunk) r70366 (py3k) The docs still need updating. If anyone with more knowledge of the documentation system than I have would like to tackle those, please feel free! -- priority: -> high resolution: -> ac

[issue5237] Allow auto-numbered replacement fields in str.format() strings

2009-03-14 Thread Eric Smith
Eric Smith added the comment: I implemented this one: field_name::= (identifier | integer | ) ("." attribute_name | "[" element_index "]")* Which I would have written as: field_name::= (identifier | integer)? ("." attribute_name | &quo

[issue1222] locale.format bug if thousand separator is space (french separator as example)

2009-03-18 Thread Eric Smith
Eric Smith added the comment: Antoine Pitrou wrote: > The problem seems to be that the thousands separator on the Solaris > variant of en_US is an empty string (rather than a comma) (*), and > apparently it hits a bug in the padding mechanism (which perhaps assumes > that t

[issue5515] 'n' formatting for int and float handles leading zero padding poorly

2009-03-18 Thread Eric Smith
New submission from Eric Smith : I think the way leading zero padding is handled for int and float by format's 'n' code is a bug. >>> import locale >>> locale.setlocale(locale.LC_ALL, 'en_US.UTF8') 'en_US.UTF8' >>> format(1

[issue5515] 'n' formatting for int and float handles leading zero padding poorly

2009-03-19 Thread Eric Smith
Eric Smith added the comment: C# doesn't seem to have the issue because they don't allow any modifies when specifying locale-aware formatting. Specifying a picture seems to be the only way to get leading zeros added. Similarly, Java looks to be pic

[issue5515] 'n' formatting for int and float handles leading zero padding poorly

2009-03-19 Thread Eric Smith
Eric Smith added the comment: Oops, assigning it to you was an error. I was just trying to figure out what your userid is so I could add you to Nosy, and I was using "Assigned To" to find it. I've fixed that. The current behavior is an accident of the implementation. The imple

[issue1413379] Popened file object close hangs in latest Cygwin update

2009-03-23 Thread Eric McRae
Eric McRae added the comment: Had forgotten about this. Just re-ran my test and it works fine now. My current versions are Python 2.5.1 and Tk 8.4 So long and thanks for all the fish... -- status: open -> closed versions: +Python 2.5 -Python

[issue3982] support .format for bytes

2009-03-24 Thread Eric Smith
Eric Smith added the comment: > I also not fan on functions having different result type > (format->bytes or str, it depends...). In 3.x, str.format() and bytes.format() would be two different methods on two different objects. I don't think there's any expectation that

[issue5686] Float formatting with no type code produces incorrect output for exponential notation

2009-04-04 Thread Eric Smith
New submission from Eric Smith : If no format specifier is supplied to a float, it's supposed to work like 'g', but with at least one digit after the decimal. This works for non-exponential notation: >>> format(1., '') '1.0' >>> format(1.

[issue5686] Float formatting with no type code produces incorrect output for exponential notation

2009-04-04 Thread Eric Smith
Changes by Eric Smith : -- type: -> behavior ___ Python tracker <http://bugs.python.org/issue5686> ___ ___ Python-bugs-list mailing list Unsubscri

[issue5686] Float formatting with no type code produces incorrect output for exponential notation

2009-04-04 Thread Eric Smith
Eric Smith added the comment: The documentation doesn't agree with the PEP. The docs at http://docs.python.org/library/string.html#formatstrings just say '' is the same as 'g'. It does not draw a distinction between exponential and fixed output. The PEP has the &quo

[issue5690] test_types fails in non-debug mode

2009-04-04 Thread Eric Smith
Changes by Eric Smith : -- assignee: -> eric.smith ___ Python tracker <http://bugs.python.org/issue5690> ___ ___ Python-bugs-list mailing list Unsubscri

[issue5690] test_types fails in non-debug mode

2009-04-04 Thread Eric Smith
Eric Smith added the comment: Problem was a debug #ifdef in the wrong place. Sorry for not testing in non-debug mode. Fixed in r71184. -- priority: release blocker -> normal resolution: -> fixed stage: needs patch -> committed/rejected status: open

[issue5686] Float formatting with no type code produces incorrect output for exponential notation

2009-04-05 Thread Eric Smith
Eric Smith added the comment: This isn't testing what I thought it was testing. I'd forgotten that format(x, '') is exactly equivalent to str(x). The better test is using a format string of '<': >>> 1e200.__format__('<') '1.0

[issue1580] Use shorter float repr when possible

2009-04-07 Thread Eric Smith
Eric Smith added the comment: My changes on the py3k-short-float-repr branch include: - Create a new function PyOS_double_to_string. This will replace PyOS_ascii_formatd. All existing internal uses of PyOS_ascii_formatd follow this pattern: printf into a buffer to build up the format string

[issue4799] handling inf/nan in '%f'

2009-04-12 Thread Eric Smith
Eric Smith added the comment: I believe this is a duplicate of issue 4482. I'm closing this and will add everyone who is nosy on this to be nosy on 4482. -- resolution: -> duplicate status: open -> closed ___ Python tracker <http://b

[issue4482] 10e667.__format__('+') should return 'inf'

2009-04-12 Thread Eric Smith
Eric Smith added the comment: This is a duplicate of 4799, which I've closed. I've resisted fixing this because differences in various platform sprintf's have made it difficult. Now that Mark Dickinson and I are close to removing the use of sprintf for float formatting, I'

[issue4482] 10e667.__format__('+') should return 'inf'

2009-04-12 Thread Eric Smith
Eric Smith added the comment: Actually this isn't quite a duplicate of 4799, but it's close. Any fix to this issue will also address 4799's original report: > On windows, with python 2.6, s = '%s' % float('inf') is 'inf',

[issue5515] 'n' formatting for int and float handles leading zero padding poorly

2009-04-12 Thread Eric Smith
Eric Smith added the comment: This won't get fixed in 3.0 or 2.6. Still not sure about 2.7, but I'm considering how to fix it there. -- versions: -Python 2.6, Python 3.0 ___ Python tracker <http://bugs.python.

[issue3382] Make '%F' and float.__format__('F') convert results to upper case.

2009-04-12 Thread Eric Smith
Changes by Eric Smith : -- nosy: +marketdickinson ___ Python tracker <http://bugs.python.org/issue3382> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue4482] 10e667.__format__('+') should return 'inf'

2009-04-12 Thread Eric Smith
Eric Smith added the comment: Agreed. That might be the strategy for 2.7. But it depends on how much of the other float and int formatting code I can re-use from 3.1. If I can hide the 2.7/3.1 differences in PyOS_double_to_string, then the 2.7 and 3.1 code should be identical, and the fix will

[issue5746] socketserver problem upon disconnection (undefined member)

2009-04-12 Thread Eric Blond
New submission from Eric Blond : Here's the traceback I got: === >>> s.serve_forever() Exception happened during processing of request from ('127.0.0.1', 54611) Traceback (most recent call last): File "C:\Python30\lib\s

[issue5746] socketserver problem upon disconnection (undefined member)

2009-04-13 Thread Eric Blond
Eric Blond added the comment: That's it actually. I forgot to call base class' setup() method when I redefined it in my subclass. When I properly call StreamRequestHandler.setup() on my derived class' setup(), everything works fine. I'm not a socketserver speciali

[issue5746] socketserver problem upon disconnection (undefined member)

2009-04-13 Thread Eric Blond
Changes by Eric Blond : -- status: open -> closed ___ Python tracker <http://bugs.python.org/issue5746> ___ ___ Python-bugs-list mailing list Unsubscri

[issue5748] Objects/bytesobject.c should include stringdefs.h, instead of defining its own macros

2009-04-13 Thread Eric Smith
New submission from Eric Smith : All of the macros it defines around line 565 should either already be in stringdefs.h, or they should be added there. The same issue exists in Objects/bytearrayobject.c. I haven't looked in 2.7, but I assume the same problem exists there. -- ass

[issue5772] For float.__format__, don't add a trailing ".0" if we're using no type code and we have an exponent

2009-04-16 Thread Eric Smith
New submission from Eric Smith : The point of the empty type code is to make sure a number looks like a float (so as to avoid formatting 2.0 as "2"). But if we have an exponent, the result already looks like a float, so there's no need to modify the number further.

[issue5772] For float.__format__, don't add a trailing ".0" if we're using no type code and we have an exponent

2009-04-16 Thread Eric Smith
Eric Smith added the comment: For a more detailed discussion, scroll to the bottom of http://mail.python.org/pipermail/python-dev/2009-April/088417.html -- ___ Python tracker <http://bugs.python.org/issue5

[issue5515] 'n' formatting for int and float handles leading zero padding poorly

2009-04-16 Thread Eric Smith
Eric Smith added the comment: Fixed in trunk (will be 3.1) in r71665. -- ___ Python tracker <http://bugs.python.org/issue5515> ___ ___ Python-bugs-list mailin

[issue5515] 'n' formatting for int and float handles leading zero padding poorly

2009-04-16 Thread Eric Smith
Changes by Eric Smith : -- ___ Python tracker <http://bugs.python.org/issue5515> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/m

[issue5515] 'n' formatting for int and float handles leading zero padding poorly

2009-04-16 Thread Eric Smith
Eric Smith added the comment: Fixed in py3k (will be 3.1) in r71665. -- ___ Python tracker <http://bugs.python.org/issue5515> ___ ___ Python-bugs-list mailin

[issue5772] For float.__format__, don't add a trailing ".0" if we're using no type code and we have an exponent

2009-04-16 Thread Eric Smith
Eric Smith added the comment: Fixed in py3k (which will become 3.1) in r71665. -- ___ Python tracker <http://bugs.python.org/issue5772> ___ ___ Python-bugs-list m

[issue5237] Allow auto-numbered replacement fields in str.format() strings

2009-04-16 Thread Eric Smith
Eric Smith added the comment: Terry, are you still interested in documenting this (please say yes!)? I'm hoping it can be done by the beta release. Thanks. Eric. -- ___ Python tracker <http://bugs.python.org/i

[issue5237] Allow auto-numbered replacement fields in str.format() strings

2009-04-16 Thread Eric Smith
Eric Smith added the comment: Terry J. Reedy wrote: > Terry J. Reedy added the comment: > > Yes, added to 'do in next few days' list. Thanks so much. -- ___ Python tracker <http://bug

[issue5775] marshal.c needs to be checked for out of memory errors

2009-04-16 Thread Eric Smith
New submission from Eric Smith : With the changes in r71665, w_object() in marshal.c needs to be checked for out of memory errors when converting floats to strings. I'm not convinced the existing error checking was correct, but I haven't spent a lot of time looking at it. The fact tha

[issue5780] test_float fails for 'legacy' float repr style

2009-04-17 Thread Eric Smith
Eric Smith added the comment: Also, remove_trailing_zeros should go inside the #ifdef so it's not included if Gay's code is being used. -- ___ Python tracker <http://bugs.python.

[issue5780] test_float fails for 'legacy' float repr style

2009-04-17 Thread Eric Smith
Eric Smith added the comment: I agree that there should be 2 behaviors, not 3. This patch looks okay to me, and tests pass both with and without defining PY_NO_SHORT_FLOAT_REPR. One nit: You don't need to use Py_CHARMASK when using the ISDIGIT macro locally defined in pystrtod.c. On the

[issue5780] test_float fails for 'legacy' float repr style

2009-04-17 Thread Eric Smith
Eric Smith added the comment: I definitely think that if you go with isdigit, you need the macro. I've been bitten by this in 3.0. My actual suggestion is to go with isdigit and the macro everywhere in this file and all files. But for just this checkin, ISDIGIT is probably

[issue5782] ',' formatting with empty format type '' (PEP 378)

2009-04-17 Thread Eric Smith
New submission from Eric Smith : PEP 378 says that the ',' format option applies to types 'd', 'e', 'f', 'g', 'E', 'G', '%' and 'F'. I think this should also be extended to include the empty type '&#x

[issue5782] ',' formatting with empty format type '' (PEP 378)

2009-04-17 Thread Eric Smith
Eric Smith added the comment: I updated the PEP in r71686. I'll fix the code and add a test after I backport the entire thing to 2.7. -- ___ Python tracker <http://bugs.python.org/i

[issue5793] Rationalize isdigit / isalpha / tolower / ... uses throughout Python source

2009-04-19 Thread Eric Smith
Eric Smith added the comment: I concur. I've also been bitten by forgetting Py_CHARMASK, so a single version that took this into account (and was locale-unaware) would be welcome. In private mail I'd mentioned that if these are functions, they should take int. But I now think that&#

[issue5775] marshal.c needs to be checked for out of memory errors

2009-04-21 Thread Eric Smith
Eric Smith added the comment: Fixed in r71783. -- resolution: -> fixed status: open -> closed ___ Python tracker <http://bugs.python.org/issue5775> ___ ___

[issue5237] Allow auto-numbered replacement fields in str.format() strings

2009-04-21 Thread Eric Smith
Eric Smith added the comment: Thanks, Terry. Your changes look reasonable to me. Can you commit them, or at least convert it to a patch against the existing docs? -- ___ Python tracker <http://bugs.python.org/issue5

[issue5237] Allow auto-numbered replacement fields in str.format() strings

2009-04-21 Thread Eric Smith
Eric Smith added the comment: Thanks, Terry. I think the only changes I'll make are: arg_name: (`identifier` | `integer`)* should be: arg_name: (`identifier` | `integer`)? And leave: conversion: "r" | "s" instead of: conversion: "r" | "

[issue5237] Allow auto-numbered replacement fields in str.format() strings

2009-04-21 Thread Eric Smith
Eric Smith added the comment: Documentation changes checked into trunk in r71788 and py3k in r71790. Issue closed. -- status: open -> closed ___ Python tracker <http://bugs.python.org/iss

[issue5793] Rationalize isdigit / isalpha / tolower / ... uses throughout Python source

2009-04-22 Thread Eric Smith
Eric Smith added the comment: Also, see _toupper/_tolower in Objects/stringlib/stringdef.h and Objects/stringobject.c. Those should be rationalized as well. -- ___ Python tracker <http://bugs.python.org/issue5

[issue5515] 'n' formatting for int and float handles leading zero padding poorly

2009-04-22 Thread Eric Smith
Eric Smith added the comment: Fixed in trunk as part of r71796. Closing the issue. -- resolution: -> fixed status: open -> closed ___ Python tracker <http://bugs.python.org/

[issue5772] For float.__format__, don't add a trailing ".0" if we're using no type code and we have an exponent

2009-04-22 Thread Eric Smith
Eric Smith added the comment: Fixed in trunk as part of r71796. Closing the issue. -- resolution: -> fixed status: open -> closed ___ Python tracker <http://bugs.python.org/

[issue5782] ',' formatting with empty format type '' (PEP 378)

2009-04-22 Thread Eric Smith
Eric Smith added the comment: Checked in to trunk in r71802 and py3k in r71804. -- resolution: -> fixed status: open -> closed versions: +Python 2.7 ___ Python tracker <http://bugs.python.org/

[issue4482] 10e667.__format__('+') should return 'inf'

2009-04-22 Thread Eric Smith
Eric Smith added the comment: I agree on the alignment issue. Maybe if you explicitly ask for the "sign" of a NaN, it should always be a space. And when requesting leading zeros, you also get leading spaces instead? -- ___ Python trac

[issue5816] Simplify parsing of complex numbers and make complex('inf') valid.

2009-04-23 Thread Eric Smith
Eric Smith added the comment: Wow, that does greatly simplify printing. One nit: the variable named 'im' isn't needed any more, you could just use 'pim'. Not sure if the asymmetry with 're' and 'pre' is worthwhile, though. Mark Dickinson wrote: &

[issue5816] Simplify parsing of complex numbers and make complex('inf') valid.

2009-04-23 Thread Eric Smith
Eric Smith added the comment: The fallback code, around line 633 in the patched version of pystrtod.c, probably also needs to be modified. It's this code that would need backporting to 2.7. -- ___ Python tracker <http://bugs.python.org/i

[issue5831] Doc mistake : threading.Timer is *not* a class

2009-04-25 Thread Eric Devolder
Changes by Eric Devolder : -- nosy: +keldonin ___ Python tracker <http://bugs.python.org/issue5831> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue5835] Deprecate PyOS_ascii_formatd

2009-04-25 Thread Eric Smith
New submission from Eric Smith : PyOS_ascii_formatd is no longer needed, now that we have PyOS_double_to_string. PyOS_ascii_formatd has a horrible interface, requiring a format string to be composed and then parsed. The format string is a very limited printf-like format string. In 2.7 and 3.1

[issue5835] Deprecate PyOS_ascii_formatd

2009-04-25 Thread Eric Smith
Eric Smith added the comment: It makes most sense to name the new 2.7 replacement function to be _PyOS_double_to_string (with a leading underscore). It will be the same as PyOS_double_to_string, except that instead of allocating a buffer and returning it, you will supply it a buffer and a

[issue5835] Deprecate PyOS_ascii_formatd

2009-04-25 Thread Eric Smith
Eric Smith added the comment: Committed in trunk as r71938. I'll use a slightly different strategy in py3k. -- ___ Python tracker <http://bugs.python.org/i

[issue1588] str.format() wrongly formats complex() numbers (Py30a2)

2009-04-27 Thread Eric Smith
Eric Smith added the comment: I agree this is a feature request. It comes down to: What should the format specifier mini-language for complex numbers look like? Should it look like the existing mini-language for floats, but have the format specified twice, with some sort of delimiter? Or just

[issue1588] str.format() wrongly formats complex() numbers (Py30a2)

2009-04-27 Thread Eric Smith
Eric Smith added the comment: Mark Dickinson wrote: >> What should the format specifier mini-language for complex numbers look >> like? >> Should it look like the existing mini-language for floats, but have >> the format specified twice, with some sort of delimiter? &g

[issue5835] Deprecate PyOS_ascii_formatd

2009-04-27 Thread Eric Smith
Eric Smith added the comment: Checked in for trunk (r71938) and py3k (r71989). -- resolution: -> accepted status: open -> closed ___ Python tracker <http://bugs.python.org/

[issue1588] str.format() wrongly formats complex() numbers (Py30a2)

2009-04-27 Thread Eric Smith
Changes by Eric Smith : -- assignee: -> eric.smith ___ Python tracker <http://bugs.python.org/issue1588> ___ ___ Python-bugs-list mailing list Unsubscri

[issue1467929] %-formatting and dicts

2009-04-27 Thread Eric Smith
Changes by Eric Smith : -- assignee: jafo -> eric.smith versions: +Python 2.7 -Python 2.6 ___ Python tracker <http://bugs.python.org/issue1467929> ___ ___ Py

[issue5793] Rationalize isdigit / isalpha / tolower / ... uses throughout Python source

2009-04-27 Thread Eric Smith
Eric Smith added the comment: I'll implement this by adding a pyctype.h and pyctype.c, mimicking . I'll essentially copy and rename the methods in bytes_methods.[ch], then change bytes_methods.h to refer to the new versions, for backward compatibility. -- assignee: -&g

[issue1467929] %-formatting and dicts

2009-04-27 Thread Eric Smith
Eric Smith added the comment: The patch incorrectly raises an exception for: '%(a)s %%' % {'a':'xyz'} I'll look into fixing it. -- ___ Python tracker &

[issue1588] str.format() wrongly formats complex() numbers (Py30a2)

2009-04-27 Thread Eric Smith
Eric Smith added the comment: > I don't see any problem with dealing with width, alignment > and padding with a user-specified fill character; I think we > should keep these if possible. It's just zero padding where > it's not clear what should happen. You're

[issue1588] str.format() wrongly formats complex() numbers (Py30a2)

2009-04-27 Thread Eric Smith
Eric Smith added the comment: > This sounds good to me. I assume a '+' would still affect > the sign of the real part? Forgot to reply to this part. Yes, a '+', '-', or ' ' would still affect the real

[issue1588] str.format() wrongly formats complex() numbers (Py30a2)

2009-04-27 Thread Eric Smith
Eric Smith added the comment: > More specifically, how about allowing widths, and the > '<', '>' and '^' alignment specifiers, but not '=', or > '0' for zero-padding. That sounds correct. > I suppose that thousands separato

[issue5793] Rationalize isdigit / isalpha / tolower / ... uses throughout Python source

2009-04-27 Thread Eric Smith
Eric Smith added the comment: Checked in to trunk (rr72040) and py3k (r72044). Windows buildbots look okay, closing. -- resolution: -> accepted status: open -> closed ___ Python tracker <http://bugs.python.org/

[issue1588] str.format() wrongly formats complex() numbers (Py30a2)

2009-04-28 Thread Eric Smith
Eric Smith added the comment: Mark Dickinson wrote: > (1) What about parentheses? The current complex repr and str have > parentheses in them, for reasons that I still don't really understand. > > I'd suggest leaving them out altogether; except that I have > the im

[issue1588] str.format() wrongly formats complex() numbers (Py30a2)

2009-04-28 Thread Eric Smith
Eric Smith added the comment: See the attached patch. Comments welcome. I'm not sure I'm doing the right thing with 'g' and appending zeros: >>> format(3+4j, '.2') '(3+4j)' >>> format(3+4j, '.2g') '3.0+4.0j' >>

[issue1588] str.format() wrongly formats complex() numbers (Py30a2)

2009-04-28 Thread Eric Smith
Eric Smith added the comment: Mark Dickinson wrote: > The trailing zeros thing is heavily bound up with issue 5858, of course; > I think we need a decision on that, one way or the other. One problem > is that I'm only proposing the issue 5858 change for py3k, not trunk. I don&#x

[issue1588] str.format() wrongly formats complex() numbers (Py30a2)

2009-04-28 Thread Eric Smith
Eric Smith added the comment: Here's a patch against py3k, with one slight change with non-empty presentation types. -- Added file: http://bugs.python.org/file13802/issue-1588-1-py3k.patch ___ Python tracker <http://bugs.python.org/i

[issue1588] str.format() wrongly formats complex() numbers (Py30a2)

2009-04-28 Thread Eric Smith
Eric Smith added the comment: Mark Dickinson wrote: >> Although I guess if we wanted to, we could say that the empty >> presentation type is equivalent to 'g', but gives you parens. > > This works for me. Me, too. > [about suppressing real zeros...] >&g

[issue1588] str.format() wrongly formats complex() numbers (Py30a2)

2009-04-28 Thread Eric Smith
Eric Smith added the comment: I'm also going to disallow the '%' format code. I don't think it makes any sense to convert a complex number to a percentage. -- ___ Python tracker <http://bu

[issue1588] str.format() wrongly formats complex() numbers (Py30a2)

2009-04-28 Thread Eric Smith
Eric Smith added the comment: ... > Is this intentional? I was expecting to get strings of length 20, > with the substring '(123+4j)' positioned either in the middle > or on the left or right. No, not intentional. I'll fix it an

[issue5864] format(1234.5, '.4') gives misleading result

2009-04-28 Thread Eric Smith
Eric Smith added the comment: I agree this should be changed. This: >>> format(1234.56, '.4') '1235.0' is definitely a problem. -- ___ Python tracker <

[issue1588] str.format() wrongly formats complex() numbers (Py30a2)

2009-04-28 Thread Eric Smith
Eric Smith added the comment: This is a patch against py3k, including tests in test_complex.py. It should deal with the padding, but let me know. -- stage: test needed -> patch review Added file: http://bugs.python.org/file13805/issue-1588-2-py3k.pa

[issue1588] str.format() wrongly formats complex() numbers (Py30a2)

2009-04-28 Thread Eric Smith
Eric Smith added the comment: I also propose to disallow the '=' alignment flag. It means put the padding between the sign and the digits, and since there are 2 signs, it's not clear what this would mean. Remember, by using .real and .imag, you can achieve this level of

[issue1588] str.format() wrongly formats complex() numbers (Py30a2)

2009-04-28 Thread Eric Smith
Eric Smith added the comment: I think these patches are complete. One for py3k, one for trunk. If no complaints, I'll apply them before this weekend's py3k beta. -- Added file: http://bugs.python.org/file13807/issue-1588-trunk.patch

[issue1588] str.format() wrongly formats complex() numbers (Py30a2)

2009-04-28 Thread Eric Smith
Changes by Eric Smith : Added file: http://bugs.python.org/file13808/issue-1588-py3k.patch ___ Python tracker <http://bugs.python.org/issue1588> ___ ___ Python-bugs-list m

[issue1588] str.format() wrongly formats complex() numbers (Py30a2)

2009-04-28 Thread Eric Smith
Changes by Eric Smith : Removed file: http://bugs.python.org/file13801/issue-1588-0.patch ___ Python tracker <http://bugs.python.org/issue1588> ___ ___ Python-bugs-list m

[issue1588] str.format() wrongly formats complex() numbers (Py30a2)

2009-04-28 Thread Eric Smith
Changes by Eric Smith : Removed file: http://bugs.python.org/file13802/issue-1588-1-py3k.patch ___ Python tracker <http://bugs.python.org/issue1588> ___ ___ Python-bug

[issue1588] str.format() wrongly formats complex() numbers (Py30a2)

2009-04-28 Thread Eric Smith
Changes by Eric Smith : Removed file: http://bugs.python.org/file13805/issue-1588-2-py3k.patch ___ Python tracker <http://bugs.python.org/issue1588> ___ ___ Python-bug

[issue5872] New C API for declaring Python types

2009-04-29 Thread Eric Smith
Changes by Eric Smith : -- nosy: +eric.smith ___ Python tracker <http://bugs.python.org/issue5872> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue5864] format(1234.5, '.4') gives misleading result

2009-04-29 Thread Eric Smith
Eric Smith added the comment: I'm getting an undefined _remove_trailing_zeros using a normal build (not using the fallback code). I think it's now always called. -- stage: patch review -> needs patch ___ Python tracker <http:/

[issue5872] New C API for declaring Python types

2009-04-29 Thread Eric Smith
Eric Smith added the comment: I think this is great stuff, Larry. It's a definite improvement. Unfortunately with my workload of other Python issues, I'm not going to be able to review this before the 3.1 beta. I don't use many PyTypeObject's, so my review would be mostly

[issue5864] format(1234.5, '.4') gives misleading result

2009-04-29 Thread Eric Smith
Eric Smith added the comment: Using the _v2 patch, I tested both with the fallback code and with Gay's code, and both work. It's sort of shocking just how much effort you had to go through! But I can't see a simpler way to do it. It looks good to me. -- stage: needs

[issue1588] str.format() wrongly formats complex() numbers (Py30a2)

2009-04-29 Thread Eric Smith
Eric Smith added the comment: Thanks, Mark. I'm not so worried about the code, but more so the tests. As far as the code goes, it's really a combination of float and string formatting. I copied the float formatting and refactored the string formatting so I could reuse it. But

[issue3382] Make '%F' and float.__format__('F') convert results to upper case.

2009-04-29 Thread Eric Smith
Eric Smith added the comment: If http://bugs.python.org/issue5859 is implemented, then this issue really just becomes making sure NAN and INF are uppercase. -- ___ Python tracker <http://bugs.python.org/issue3

[issue5799] Change ntpath functions to implicitly support UNC paths

2009-04-30 Thread Eric Smith
Eric Smith added the comment: The doc patch doesn't apply cleanly for me. There are a number of code cleanups in the patch, like 0->False, 1->True, the improvement of the params to path(), improvement in isabs(), etc. I think these cleanups should be made in a separate patch, s

[issue5859] Remove implicit '%f' -> '%g' switch from float formatting.

2009-05-01 Thread Eric Smith
Eric Smith added the comment: The patch looks good to me. -- ___ Python tracker <http://bugs.python.org/issue5859> ___ ___ Python-bugs-list mailing list Unsub

[issue1588] str.format() wrongly formats complex() numbers (Py30a2)

2009-05-02 Thread Eric Smith
Eric Smith added the comment: Is this suggestion for all types, or just complex? Because float has the same issue. >>> format(pi, '') '3.14159265359' [38243 refs] >>> format(pi, '>') '3.14159' -- __

[issue1588] str.format() wrongly formats complex() numbers (Py30a2)

2009-05-02 Thread Eric Smith
Eric Smith added the comment: > Hmm. That also seems wrong to me. So I guess it's a suggestion > for float as well, which means it's not specific to this issue. > Should I open a separate feature request? Yes, this is a separate issue. It comes from PEP 3101's specifi

[issue5914] Add PyOS_string_to_double function to C API

2009-05-03 Thread Eric Smith
Eric Smith added the comment: This looks okay to me (although since it's not hooked up I haven't tested it). I particularly like that it doesn't allow leading whitespace, and that the caller no longer has to remember errno (forgetting to set and/or test it have both caused me

<    27   28   29   30   31   32   33   34   35   36   >