[issue1780] Decimal constructor accepts newline terminated strings

Facundo Batista report at bugs.python.org
Thu Jan 10 13:09:48 CET 2008


Facundo Batista added the comment:

I think that the Spec disallows additional whitespace to not allow, for
example, "2. 34" as "2.34", or "10 e-12".

I don't see any harm in having "  2.34" or "5.73\n" as good input
values, as long we remove those characters at both ends.

I propose to just make a .strip() at the input string, change the
documentation to reflect this, and that's all.

The doc says: "If value is a string, it should conform to the decimal
numeric string syntax:"

We can put: "If value is a string, it should conform to the decimal
numeric string syntax after being stripped on both ends:"

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1780>
__________________________________


More information about the Python-bugs-list mailing list