Skip to content
This repository has been archived by the owner on Apr 9, 2024. It is now read-only.

Make Todo's comparable to allow for sorting? #8

Open
lordminx opened this issue Mar 7, 2018 · 2 comments
Open

Make Todo's comparable to allow for sorting? #8

lordminx opened this issue Mar 7, 2018 · 2 comments

Comments

@lordminx
Copy link

lordminx commented Mar 7, 2018

First: Thanks for writing and publishing a cool package!

I started using todotxtio for a little project of mine where I needed something to parse my todo.txt and while playing around with it I noticed that Todo objects are not comparable and thus can't easily be sorted using list.sort() or sorted(). Since this was functionality I was missing I implemented a very rough and NOT production/pull ready sketch of this using functools total_ordering decorator.

Only afterwards I read Issue #2, which I interpret to mean that not adding comparability was intentional and so I figured I open up a new issue and, well, ask:

Is the fact that Todo objects are not comparable to each other the way things are supposed to work or would you accept a PR to add that functionality?

@lordminx lordminx changed the title Make todos comparable to allow for sorting? Make Todo's comparable to allow for sorting? Mar 7, 2018
@EpocDotFr
Copy link
Owner

EpocDotFr commented Mar 7, 2018

Hi Lordminx and thank you for your interest in Todo.txt I/O!

Only afterwards I read Issue #2, which I interpret to mean that not adding comparability was intentional and so I figured I open up a new issue and, well, ask:
Is the fact that Todo objects are not comparable to each other the way things are supposed to work or would you accept a PR to add that functionality?

That's a good question. When I was developing Web Todo.txt I figured out it was easier to sort tasks on the client-side rather than in the server-side (in fact, it was useless to sort those tasks server-side because the client-side may change the order of the tasks for several reasons at any time without making any request to get a frest tasks list).

Of course there isn't any reason a list of Todo objects cannot be sorted using native Python methods. So yes, your PR is welcome!

@EpocDotFr
Copy link
Owner

EpocDotFr commented Mar 7, 2018

If you make a PR, please create a Contributors section in the readme (just like here) 😄

Also don't forget to write docs (everything is located in the docs folder), it's ReStructuredText files. And of course, docstrings!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants