-
Notifications
You must be signed in to change notification settings - Fork 18
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
don't accept Exception for one(default) #38
Comments
Pointed out by @zwn at gratipay/gratipay.com#2106 (comment)
What's the behavior if both |
Complain? |
Or call it |
Yeah, maybe. I thought it was okay to use |
Do we have a precedence somewhere in python world when it would be common to raise |
No, not that I'm aware of.
It does behave like dict.get, unless the value is an exception.
Though raising in the zero case is a common use case, I don't know of other APIs that provide this functionality in this way, via foo = db.one("select blah")
if foo is None:
raise DoesntExist That's the common case I'm referring to. Since foo = db.one("select blah", default=DoesntExist) Since this overloads foo = db.one("select blah", or_raise=DoesntExist) If we do that, I like the idea of complaining if both I'm seeing this as a backwards incompatible change, so it would go into 3.0. |
What I don't like about |
From @zwn at 935feba#commitcomment-5532271 :
The text was updated successfully, but these errors were encountered: