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

feature: Return None instead of False #71

Open
j123b567 opened this issue Jun 16, 2020 · 2 comments
Open

feature: Return None instead of False #71

j123b567 opened this issue Jun 16, 2020 · 2 comments

Comments

@j123b567
Copy link

In latest versions, there was made bad decision to replace None with False. It is now not possible to distinguis between False and not set entry because neither KeyError nor None is returned like in all other standard python interfaces (eg. dict)

Only good way to solve this would be to mimic python dict and introduce full featured get() method with user configurable default argument, which is used when there is no entry in the db with default default set to None.

Please, can you revert it back and use None in every case, where there is no single item to return or at least introduce optional default argument, so it is possible for the user to overcome this bad decision without maintaining its own downstream version.

@patx
Copy link
Owner

patx commented Oct 7, 2020

Let me know which commit this change was made in so I can review, thanks.

@j123b567
Copy link
Author

j123b567 commented Oct 7, 2020

89897b4
This commit says that it is because of consistency, but it is against it.

None of lgetall, lget, lpop, dget, dpop return False in case of missing key. They will instead raise KeyError.

Other methods never return data so they are irrelevant for comparison.

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

No branches or pull requests

2 participants