Message107622
Nice implementation. I wonder if the /5 loop can be eliminated by noting that /5 is *2 followed by decimal shift. (Probably not without fast decimal arithmetics.)
A few documentation nits:
1. In Decimal methods there is no consistency in referring to self. I see "given Decimal", "the number", and "the argument" in three entries around as_integer_ratio().
2. Is there a reason that docstring is more detailed than manual entry? I think the manual should describe exceptions.
3. Is there a reason to use different language for float.as_integer_ratio() and Decimal.as_integer_ratio()?
I know, ""A foolish consistency is the hobgoblin of little minds..." - feel free to ignore my observations.
A tiny code nit: to me it would be clearer to start with d2 = d5 = -self._exp after the "# Find d2, d5 ..." comment. For a moment I was puzzled why you promise d2 and d5, but then process d5 only.
Also, by the time of the "if not self" check, special case has been eliminated, so you can simply check self._int == 0. |
|
Date |
User |
Action |
Args |
2010-06-12 03:24:52 | belopolsky | set | recipients:
+ belopolsky, mark.dickinson, skrah |
2010-06-12 03:24:52 | belopolsky | set | messageid: <1276313092.61.0.614862569214.issue8947@psf.upfronthosting.co.za> |
2010-06-12 03:24:51 | belopolsky | link | issue8947 messages |
2010-06-12 03:24:50 | belopolsky | create | |
|