[Tim Peters] #- I expect everyone's initial reaction will be to say "no #- limit", but think #- two or three times about that. Eliminating any restriction #- on exponent #- magnitude is the same as saying overflow can never happen. #- But overflow is #- usually a valuable safety net in real life, telling you that #- your algorithm #- has gone insane. OTOH, there's nothing with physical #- significance that #- requires an exponent anywhere near as large as 999999999, #- and REXX has used #- that exponent limit for years without problems. But it's still an artificial restriction. We have no-limit longs, should have limited Decimal? And also implies more code and complexity in the module. But this is a side effect and not the primary concern in the decision. #- (c) also specifies ways to spell special values, like NaNs #- and infinities. #- Does Decimal(string)? I don't believe the PEP covered that. Yes, it does. I missed mention it and an example in the PEP. Already fixed. #- In any case, from_string() should be subsumed by #- Decimal(string), perhaps #- with via an optional "use_context" flag argument. You mean something like Decimal(string, use_context=True)? And when creating from long, for example? Remember that the spec says that the context affect the operations, not creations (with the exception of from_string). #- It's quite arguable that str() should be exactly the standard's #- to_sci_string() (and for those who haven't read the spec, do #- before you #- complain about that -- no, you don't always get an exponent under #- to_sci_string()). I'm lost here. Are you saying that str() should have the same behaviour that to_sci_string()? #- > Hash behaviour #- > -------------- #- #- Decimals that happen to be exact integers must return the #- same hash codes as #- the hash codes of the ints or longs they're equal to. All #- bets are off wrt #- hash codes for non-integral Decimals (e.g., #- hash(Decimal('1.5')) may or may #- not be the same as hash(1.5)); promising more than that is simply #- impractical. #- #- BTW, hash(Decimal('1.0')) must be the same as #- hash(Decimal('1.00')) must be #- the same as hash(Decimal('0.001e3')) despite that they have different #- internal representations. I agree completely with this behaviour. . Facundo
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