[issue36117] Allow rich comparisons for real-valued complex objects.

2019-02-26 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: NaN and complex numbers are not orderable by definition. This is a feature, not a bug. -- resolution: -> not a bug stage: patch review -> resolved status: open -> closed ___ Python tracker

[issue36117] Allow rich comparisons for real-valued complex objects.

2019-02-26 Thread Brandt Bucher
Change by Brandt Bucher : -- type: enhancement -> behavior ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: ht

[issue36117] Allow rich comparisons for real-valued complex objects.

2019-02-26 Thread Brandt Bucher
Brandt Bucher added the comment: > The rules for when things are comparable or not should be kept simple. I think that the sort of user who uses complex numbers for their numerical calculations would still find this behavior "simple", but that may just be me. > We don't want to have objects

[issue36117] Allow rich comparisons for real-valued complex objects.

2019-02-26 Thread Eric V. Smith
Eric V. Smith added the comment: -1. We don't want to have objects that are orderable depending on their values. I can't think of anywhere else we do this. It would be very easy to have a complex == 42+0.001j, after some calculation. This near-zero imaginary part would prevent it from be

[issue36117] Allow rich comparisons for real-valued complex objects.

2019-02-26 Thread Mark Dickinson
Mark Dickinson added the comment: -1 from me. The rules for when things are comparable or not should be kept simple. -- ___ Python tracker ___ ___

[issue36117] Allow rich comparisons for real-valued complex objects.

2019-02-26 Thread Brandt Bucher
Brandt Bucher added the comment: I don't really see, though, how comparing complex(42) == float(42) is any less dangerous than complex(42) <= float(42). It seems odd to me, personally, that real-valued complex objects are valid for *some* rich comparisons (but not others) when the math is un

[issue36117] Allow rich comparisons for real-valued complex objects.

2019-02-26 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: If you need to order real-valued complex object, convert them to float objects first. -- ___ Python tracker ___ __

[issue36117] Allow rich comparisons for real-valued complex objects.

2019-02-26 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I don't think we should do this. In numerical computation we should not depend on exact floating point values, because is affected by computation errors. It would be hard to debug the program when some complex numbers are orderable, but other are not, and

[issue36117] Allow rich comparisons for real-valued complex objects.

2019-02-26 Thread Brandt Bucher
Change by Brandt Bucher : -- keywords: +patch pull_requests: +12073 stage: -> patch review ___ Python tracker ___ ___ Python-bugs-l

[issue36117] Allow rich comparisons for real-valued complex objects.

2019-02-26 Thread Brandt Bucher
New submission from Brandt Bucher : Currently, it isn't legal to perform <, >, <=, or >= rich comparisons on any complex objects, even though these operations are mathematically well-defined for real numbers. The attached PR addresses this by defining rich comparisons for real-valued complex