Re: Complex 'compare'

2018-12-25 Thread Frank Millman
"Frank Millman" wrote on 2018-12-18 in message news:... I want to compare two tuples. They each represent a row in a database, and each element represents a column, so I will use that terminology. I need to know if one row is greater than or less than the other. The sort sequence can be com

RE: Complex 'compare'

2018-12-18 Thread Avi Gross
ce it in a try/catch statement as any error would also be a false. Just some thoughts. -Original Message- From: Python-list On Behalf Of Frank Millman Sent: Tuesday, December 18, 2018 6:39 AM To: python-list@python.org Subject: Re: Complex 'compare' "Chris Angelico" w

RE: Complex 'compare'

2018-12-18 Thread Avi Gross
(1 + 3j,2 +4j) TypeError: '>' not supported between instances of 'complex' and 'complex' And the reason is obvious as complex numbers have two dimensions so you might need to compare something like their magnitude as in the length of a vector ... -Original M

Re: Complex 'compare'

2018-12-18 Thread Frank Millman
"Chris Angelico" wrote in message news:CAPTjJmpLuyFf04AT+34VraJ5itDvNySVJspEv=ddwdsmmsf...@mail.gmail.com... On Tue, Dec 18, 2018 at 9:52 PM Frank Millman wrote: > I need to know if one row is greater than or less than the other. The > sort > sequence can be complex - one or more columns, eac

Re: Complex 'compare'

2018-12-18 Thread Chris Angelico
On Tue, Dec 18, 2018 at 9:52 PM Frank Millman wrote: > I need to know if one row is greater than or less than the other. The sort > sequence can be complex - one or more columns, each of which can be sorted > ascending or descending. > > Below is the function I have come up with. Can anyone see an

Complex 'compare'

2018-12-18 Thread Frank Millman
Hi all I want to compare two tuples. They each represent a row in a database, and each element represents a column, so I will use that terminology. I need to know if one row is greater than or less than the other. The sort sequence can be complex - one or more columns, each of which can be so