-
-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using an external comparator? #74
Comments
Hi, Unfortunately, there's no support for a Apart from subclassing |
I was hoping that you could set the config to support a key or cmp at the
beginning, so that portion would know where to look at when it encountered
an object of this type. Alas, if this would come at a large cost, then we
can close the issue.
Thanks!
…On Sat, 21 Jan 2023, 17:37 Alexandre Decan ***@***.***> wrote:
Hi,
Unfortunately, there's no support for a cmp function for objects that do
no support usual comparison operators. While the code of portion could
possibly be changed to deal with such a function, doing so will make the
code much less readable, so that's not an option I envision ;-)
Apart from subclassing AbsoluteDate, I don't see any other possibility
:-/ I see there's an absolutedate_to_datetime function. Would it be
possible to use this instead of AbsoluteDate instances?
—
Reply to this email directly, view it on GitHub
<#74 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AO7QEK2JQ5LC3ZLRNHS74PTWTQGDRANCNFSM6AAAAAAUCMUEG4>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Unfortunately, that's not the case. Supporting |
Hallo Alexandre,
I am currently working with an external library that provides an
AbsoluteDate
class. To compare these objects, it provides a comparator, but not the python native_gt_
,_lt_
etc. Now I don't want to subclass it as it is rather core class and actually it is written in java - I am using it with a python wrapper. The java native project is Orekit and the Python wrapper is here. And with only a comparator I can't seem to useportion
I can do sorting etc. using
key=functools.cmp_to_key(AbsoluteDate.compareTo)
, so the question is: Can I define an externalkey
like this toportion
, so that it knows how to compare things and works properly.Otherwise I will be forced to subclass
AbsoluteDate
, add the usual comparison operators, and hope nothing breaks while jumping between java and python.Thanks!
The text was updated successfully, but these errors were encountered: