Skip to content
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

Return empty list when no matches are found #654

Closed
LeXofLeviafan opened this issue Dec 16, 2022 · 2 comments · Fixed by #660
Closed

Return empty list when no matches are found #654

LeXofLeviafan opened this issue Dec 16, 2022 · 2 comments · Fixed by #660

Comments

@LeXofLeviafan
Copy link
Collaborator

Currently, some BukuDb methods (searchdb(), search_by_tag()) that return a list are returning None instead of an empty list (…sometimes).

This doesn't seem to improve the result usability (empty list is just as falsey as None), and conversely may complicate its processing (since None can't be iterated over nor concatenated). Thus, I suggest always returning a list value in these methods.

…Also, some methods (get_rec_all(), search_keywords_and_filter_by_tag(), exclude_results_from_search()) always return a list (regardless of documented return type), which makes the API inconsistent.

@jarun
Copy link
Owner

jarun commented Dec 16, 2022

This is OK but make sure you have the correct check in the callers.

@jarun
Copy link
Owner

jarun commented Dec 16, 2022

From the next suggestion, please share in the buku-dev discussion room. Please don't add one defect for each suggestion.

LeXofLeviafan added a commit to LeXofLeviafan/buku that referenced this issue Jan 7, 2023
LeXofLeviafan added a commit to LeXofLeviafan/buku that referenced this issue Jan 7, 2023
LeXofLeviafan added a commit to LeXofLeviafan/buku that referenced this issue Jan 7, 2023
LeXofLeviafan added a commit to LeXofLeviafan/buku that referenced this issue Jan 22, 2023
LeXofLeviafan added a commit to LeXofLeviafan/buku that referenced this issue Jan 27, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Feb 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants