arrow icon indicating copy to clipboard operation
arrow copied to clipboard

Documentation doesn't mention comparison

Open maweki opened this issue 3 years ago • 3 comments

Issue Description

The documentation does in no way mention that comparison of Arrow-objects (and therefore sorting, adding them to a search tree, etc.) is possible. The api reference does not list __lt__ and __gt__, etc.. As dates and timezones are difficult (hence the existence of this library) it is not entirely clear that this is allowed and how it should be handled. Not the most intuitive idea, but it would be possible that dates are compared in local time and not in UTC.

Anyways, comparison is supported

https://github.com/arrow-py/arrow/blob/master/arrow/arrow.py#L1762-L1767

The documentation should either have a subsection "Comparison" or the dunder-methods for comparison should be listed in the api reference (or both). It should be stated how the comparison works, eg. by comparison of some underlying object.

maweki avatar May 28 '21 09:05 maweki

Nice find @maweki!

Thanks for reporting this in! Documentation is always a challenge :)

Would you like to have a go at filling in the gap with a PR?

krisfremen avatar May 30 '21 11:05 krisfremen

@krisfremen Sure I can give it a try. In terms of general applicability I would think it goes very far up either between "Creation" and "Properties" or before or after "Convert" (though I would think that "Format" would be better after "Convert" and right before "Humanize", as humanizing is also a kind of formatting).

What do you think where I should put this (probably small) section?

maweki avatar May 31 '21 11:05 maweki

I tend to think it should go after properties. Let's use the title "Compare" and keep it in a similar style to the other sections.

systemcatch avatar Jun 25 '21 07:06 systemcatch