You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using _missing to correct reproduce the behaviour of pop, and re-using self.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:
MarcinKonowalczyk
changed the title
Proposal: TypeConversionDict should also have a pop method
Proposal: Should TypeConversionDict also have a pop method?
Apr 23, 2024
davidism
changed the title
Proposal: Should TypeConversionDict also have a pop method?TypeConversionDict.pop could pop with type
Apr 23, 2024
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.
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: