Mark Dickinson added the comment:

This is a feature request rather than a bug.  There's a least one good 
reason not to do this, namely that the specification on which the decimal 
module is based specifically disallows this:  At

it says:  "No blanks or other white space characters are permitted in a 
numeric string.", and the "to-number" operation of the specification, 
which converts strings to Decimal instances, is expected only to accept 
numeric strings.

Of course, all the specification requires is that the functionality of to-
number is present in the Decimal module *somewhere*:  currently it's 
implemented by Decimal.__new__, but it would be possible to alter 
Decimal.__new__ to allow leading and trailing spaces, and have a strictly 
conforming to-number implementation elsewhere in the Decimal module.  I 
don't think there's any real benefit to this.  It's easy enough to add a 
call to strip() to the Decimal argument.

I recommend closing this issue as a "won't fix".

nosy: +marketdickinson
type:  -> rfe

Python-bugs-list mailing list 

Reply via email to