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
Frank, I am not commenting on your specific code, just asking a question. If you have two tuples of the same size it does seem that python evaluates them in the order you want just by doing something like this example I made with a 2-tuple: >>> (1, 2) > (2,1) False >>> (1, 2) > (1,1) True >>> (1

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