-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
TypeConversionDict.pop
could pop with type
#2883
Comments
TypeConversionDict.pop
could pop with type
I'm taking the change of title from a question to a statement as a tentative approval of the idea. Hence, see PR for code. The actual implementation ended up being a bit more messy than proposed but its roughly the same idea. |
After discussing it with other maintainers, we don't want to accept the additional complexity right now, when Werkzeug itself won't use it. Thanks for working on this. |
Cool. No worries! Thanks for considering! :)) |
TypeConversionDict provides a
type
argument for theget
method, but does not do the same forpop
. Currently this is the way to do a typed pop:I propose:
Implementation suggestion:
I'm using
_missing
to correct reproduce the behaviour of pop, and re-usingself.get
sice we don't want the item to be pop-ed if the type-conversion fails (yes??. i guess that's the tricky bit, no?)The text was updated successfully, but these errors were encountered: