-
-
Notifications
You must be signed in to change notification settings - Fork 385
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
Document comparison #768
Document comparison #768
Conversation
Looks good to me, simple and direct.
|
I believe I have addressed everything except 3. I'd be happy to add a fake doctest but someone else has to write it for me because I've never used neither NumPy nor Pandas. 😳 |
I just realized that we were going to provide a wrapping class, since numpy and pandas do not follow the key model. In both cases, you need to use a comparison function that takes 2 arguments. This was discussed in the original PR. Shall we provide a function like Alternatively, and probably easier, we can not mention numpy in this release, and add it back via a different PR. |
Hm, I think it would be nicer to publish all at once if it isn't too much work. We had decided on the API IIRC and it shouldn't be too complex to add? 🤔 Just adding the APIs that landed without NumPy support seems to be lacking the main effect? :) |
That works as well. I'll work on it later today, if that is okay? |
There is another point on Should we de-deprecate it and keep it permanently as syntactic sugar? That would save users from having to wirte Just a thought. |
It's not like I can cut your salary. ;) If we get it done by tomorrow it's be more than great. RedHat wants a release but there's some minor stuff I need to address first anyways.
Yes we should. It was very obvious to me while writing the docs. :) |
How about something along these lines? The same logic used to validate
def using(eq: Callable = None, order: Callable = None, cmp: Callable = None, enforce_same_class: bool = True) -> Callable:
@attr.s(eq=False, order=False)
class Comparable(object):
value = attr.ib()
def __eq__(self, other):
pass
def __lt__(self, other):
pass
...
return Comparable Note: I think we should let the user choose whether equal classes should be enforced, since the whole point of the PR is to let the user customize the operation. |
If everything is done by one function, what's the point of the module? Storing helpers? |
To follow the pattern of validators, etc, but most of all I thought it looked good. |
I'm not opposed to it, I'd just like to think it through. I could live with a helper for Numpy/Pandas for instance, if it's possible without importing them. |
I wouldn't add specific helpers for numpy/pandas. Too much trouble and too little added value, if all the user needs is |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool!
Co-authored-by: Julian Berman <[email protected]>
Co-authored-by: Julian Berman <[email protected]>
Co-authored-by: Julian Berman <[email protected]>
Oooof sorry I lost the thread on this one! Yes please, I’d like to push 21.1.0 but realized this is still open. Any chance to get it done sometime next week? |
Working on this now. |
These are some narrative docs for #627, I'm open to suggestions to make it juicier.
Here's the built version: https://attrs--768.org.readthedocs.build/en/768/comparison.html
@Julian @botant