Message59582
Thanks again for the excellent comments.
__init__: good catch.
repr(Rational): The rule for repr is "eval(repr(object)) == object".
Unfortunately, that doesn't decide between the two formats, since both
assume some particular import statements. I picked the one more likely
to be unique, and I assume Decimal picked the shorter one. I can go
either way.
_gcd's sign: It's a happy accident for me. Possibly Sjoerd Mullender
designed it that way. I've added a comment and a test.
__ceil__: I like that implementation better.
2-argument round: Fixed and tested.
equality: Very good point. I've stolen the sandbox code and added
Rational.from_float() using it. I think I also need to make this change
to the comparisons.
hashing: oops, yes these should be hashable. Decimal cheats by comparing
!= to even floats that it's equal to, so I'm going to assume that they
also want Rational(5,2) != Decimal('2.5').
The new patch is against 2.6. |
|
| Date |
User |
Action |
Args |
| 2008-01-09 07:36:25 | jyasskin | set | spambayes_score: 0.0178809 -> 0.0178809 recipients:
+ jyasskin, gvanrossum, mark.dickinson |
| 2008-01-09 07:36:25 | jyasskin | set | spambayes_score: 0.0178809 -> 0.0178809 messageid: <1199864185.54.0.551339308957.issue1682@psf.upfronthosting.co.za> |
| 2008-01-09 07:36:24 | jyasskin | link | issue1682 messages |
| 2008-01-09 07:36:22 | jyasskin | create | |
|