On Thursday, March 6, 2014 11:30:47 PM UTC-6, Andrew Barnert wrote:
No one would expect that the user should know to quote the number---when is that ever done?
What does quoting have to do with anything? Do you not understand why Decimal('.1') works? It's not because Python is a weakly-typed language that allows you to use strings as numbers, but because Decimal has a constructor that takes strings, for a specific and well-documented reason. Quoting here would just give you a TypeError. And nothing in your proposal(s) would change that.
I understand precisely what it happening. It is just the opposite of what you
are implying (that I'm ignorant) which you actually state later. I full well
know that the quoted string is forcing the right constructor to be called for the
Decimal object. I am an experienced OO programmer and have many years
under my belt with C++, Smalltalk, and Java. Please don't be pedantic with
me, nor imply that I am ignorant. It does not become you, and it irritates me...
besides, it gets in the way of discussion. My point is not about loose typing,
nor about Decimal constructors, ... my point is
that an average user entering a number into a sqrt() function is not going to
realize that they need to enter a quoted string in order to force the string
constructor on the Decimal Class !! They are going to want to enter this --> sqrt( .789 ) not this sqrt( '0.789' )
I know how it works. I'm asking for a reasonable response to the need for normal usability.