homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author meador.inge
Recipients mark.dickinson, meador.inge
Date 2010年05月19日.13:13:59
SpamBayes Score 7.0313104e-07
Marked as misclassified No
Message-id <1274274842.07.0.623660694228.issue8748@psf.upfronthosting.co.za>
In-reply-to
Content
> For a complex number z and an integer i, 'z == i' should be exactly 
> equivalent to 'z.real == i and z.imag == 0.0'.
Like you mentioned before a lot of care is taken in 'floatobject.c' to ensure that the comparison is robust. Would it be a good approach to leverage that work?
I have attached a patch with that idea. If it seems reasonable, then I can clean it up and add more tests. I created the patch for py3k. I think the 2.x changes will be slightly different due to the coercion aspects.
One of the unit tests ('test_complex.test_richcompare') explicitly checks for the overflow. However, the approach of just having the comparison return 'False' in these cases is more robust. Is there any use case for explicitly notifying of overflow with comparisons? It seems like more of an implementation artifact to me...
History
Date User Action Args
2010年05月19日 13:14:02meador.ingesetrecipients: + meador.inge, mark.dickinson
2010年05月19日 13:14:02meador.ingesetmessageid: <1274274842.07.0.623660694228.issue8748@psf.upfronthosting.co.za>
2010年05月19日 13:14:00meador.ingelinkissue8748 messages
2010年05月19日 13:14:00meador.ingecreate

AltStyle によって変換されたページ (->オリジナル) /