-
-
Notifications
You must be signed in to change notification settings - Fork 9
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
String to boolean conversion #9
Comments
Usually I'd say the default behaviour of Python might be the least surprising to a user of a library. But in that particular case it would mean that converting So I guess it might make sense to handle this in undictify. What strings should we convert to
(With the string being converted to lowercase first?) |
It just makes so much sense, so I quickly implemented it. :) |
Thanks again a lot for this very helpful report. Stuff like this really improves the library. :) |
Wow, I wasn't even able to answer - thanks so much for the quick response! |
If a component in the the standard library does it that way, I guess it's fine. :) |
Hi!
We had a confusing encounter today while using
type_checked_constructor
withconvert=True
.A minimal reproducible example is the following:
This is due to Python casting any string to
True
if it's not empty, but it comes out as surprising if, as in our case, you are parsing a dictionary of GET parameters, that come in as strings.What would you suggest as the best course of action? Is this something you might want to address in undictify or should we build a thin conversion layer just for booleans before feeding data into a class decorated with undictify's type_checked_constructor?
The text was updated successfully, but these errors were encountered: