[issue9574] complex does not parse strings containing decimals

2010-08-28 Thread Mark Dickinson
Mark Dickinson added the comment: If someone does want to produce a patch, here's the grammar that I suggest, in pseudo BNF form. This would be reasonably simple to implement, and is also simple to describe. whitespace = ' ' | '\t' | '\n' | '\v' | '\f'# include other non-ASCII whitespac

[issue9574] complex does not parse strings containing decimals

2010-08-28 Thread Mark Dickinson
Mark Dickinson added the comment: Unassigning myself from this one, though I'll review a patch if anyone wants to write one. After thinking about it a bit, I'm -0 on allowing the extra whitespace. The main issue for me is that it opens up a can of worms about what should and shouldn't be al

[issue9574] complex does not parse strings containing decimals

2010-08-12 Thread Jervis Whitley
Jervis Whitley added the comment: It hadn't occurred to me to try this without spaces. Thank you for pointing this out. Agreed that the enhancement is not essential. -- ___ Python tracker _

[issue9574] complex does not parse strings containing decimals

2010-08-12 Thread Mark Dickinson
Mark Dickinson added the comment: I don't think determining *which* whitespace is allowed is a problem; just use whatever's already being used for the whitespace that's already allowed (around the whole complex input, for example, or between the optional parentheses and the number). Please o

[issue9574] complex does not parse strings containing decimals

2010-08-12 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: I did some experimentation and found some inconsistency between int and complex: >>> int('\xA11') Traceback (most recent call last): File "", line 1, in UnicodeDecodeError: 'utf8' codec can't decode byte 0xa1 in position 0: invalid start byte but >>>

[issue9574] complex does not parse strings containing decimals

2010-08-12 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: Current behavior is also consistent with that of fractions: >>> Fraction("1/2") Fraction(1, 2) >>> Fraction("1 / 2") Traceback (most recent call last): .. ValueError: Invalid literal for Fraction: '1 / 2' I am -1 on this RFE. At most, this can be clar

[issue9574] complex does not parse strings containing decimals

2010-08-12 Thread Mark Dickinson
Mark Dickinson added the comment: I'm wondering whether the moratorium (PEP 3003) applies to this; from a close reading I'd say it does. At any rate, it seems like an inessential enhancement, so I'd be happy to delay this until 3.3. -- versions: +Python 3.3 -Python 3.2 _

[issue9574] complex does not parse strings containing decimals

2010-08-12 Thread Mark Dickinson
Changes by Mark Dickinson : -- stage: -> needs patch versions: +Python 3.2 -Python 2.5, Python 2.6, Python 2.7, Python 3.1 ___ Python tracker ___

[issue9574] complex does not parse strings containing decimals

2010-08-12 Thread Mark Dickinson
Mark Dickinson added the comment: Note also that spaces are already allowed immediately inside the parentheses in a string argument to the complex constructor (in python 2.6 and later): >>> complex("( 1.1+2.1j )") (1.1001+2.1001j) -- _

[issue9574] complex does not parse strings containing decimals

2010-08-12 Thread Mark Dickinson
Mark Dickinson added the comment: The problem here is the spaces in the input string: newton:~ dickinsm$ python2.7 Python 2.7 (r27:82500, Jul 13 2010, 14:10:05) [GCC 4.2.1 (Apple Inc. build 5659)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> complex("1.1

[issue9574] complex does not parse strings containing decimals

2010-08-12 Thread Jervis Whitley
New submission from Jervis Whitley : complex() raises ValueError when parsing a string argument containing both real and imaginary where one of the real or imaginary is a decimal. To reproduce: >>> complex("1.1 + 2.1j") ValueError: complex() arg is a malformed string >>> complex("2.1j") 2.1j