-
Notifications
You must be signed in to change notification settings - Fork 389
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
sort input validation #1517
sort input validation #1517
Conversation
@@ -100,10 +100,32 @@ def sort(child, key=None, ascending=True): | |||
ascending : bool, optional | |||
Determines order of the sort | |||
""" | |||
if ascending not in (True, False): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are we not just calling bool on the object?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To guard against calls like:
t.sort('a', 'b')
When the user should have done
t.sort(['a', 'b'])
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, this is really helpful, I have tried to do that in the past. Can you just put a small comment in the source here that explains why we are doing this so I remember in the future?
No description provided.