Alexander Belopolsky <belopol...@users.sourceforge.net> added the comment:

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.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue8947>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to