On 11/28/2010 3:58 PM, Alexander Belopolsky wrote: > On Sun, Nov 28, 2010 at 3:43 PM, Antoine Pitrou<solipsis at pitrou.net> wrote: > .. >>> For example, >>> I don't think that supporting >>> >>>>>> float('١٢٣٤.٥٦') >>> 1234.56 Even if this is somehow an accident or something that someone snuck in, I think it a good idea that *users* be able to input amounts with their native digits. That is different from requiring *programmers* to write literals with euro-ascii-digits >>> is more important than to assure users that once their program >>> accepted some text as a number, they can assume that the text is >>> ASCII. >> >> Why would they assume the text is ASCII? > > def deposit(self, amountstr): > self.balance += float(amountstr) > audit_log("Deposited: " + amountstr) If the programmer want to assure ascii, he can produce a string, possible formatted, from the amount depform = "Deposited: ${:14.2f}".format def deposit(self, amountstr): amount = float(amountstr) self.balance += amount # audit_log("Deposited: " + str(amount) # simple version audit_log(depform(amount)) Given that amountstr could be something like ' 182.33 ', I think programmer should plan to format it. -- Terry Jan Reedy
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4