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
Shorter getter names #175
Labels
Comments
Actually, we could/should even use Python's |
hemberger
added a commit
to hemberger/MechanicalSoup
that referenced
this issue
Jan 4, 2018
Closes MechanicalSoup#175. The most convenient way to access the page, url, and form objects is to use properties, which are mapped to the appropriate getter functions using `property`.
moy
pushed a commit
to moy/MechanicalSoup
that referenced
this issue
Aug 14, 2019
Closes MechanicalSoup#175. The most convenient way to access the page, url, and form objects is to use properties, which are mapped to the appropriate getter functions using `property`. * get_current_page -> page property The previous method name was simply too long for such a commonly used function. The "current" adjective added no extra specificity. * get_current_form -> form property This is changed for clarity. What is the "current" form if there are multiple forms on the page? Instead, we make it clearer by describing it as the "selected" form. * get_url -> url property This is just an elimination of the get_ prefix and use a property. For backwards compatibility, the older method names remain as aliases.
I believe this was unintentionally closed. |
Indeed, I messed up with a push (which I cancelled immediately but it already applied the "fixes" directive). The current pr is #294. |
moy
pushed a commit
to moy/MechanicalSoup
that referenced
this issue
Sep 17, 2019
Closes MechanicalSoup#175. The most convenient way to access the page, url, and form objects is to use properties, which are mapped to the appropriate getter functions using `property`. * get_current_page -> page property The previous method name was simply too long for such a commonly used function. The "current" adjective added no extra specificity. * get_current_form -> form property This is changed for clarity. What is the "current" form if there are multiple forms on the page? Instead, we make it clearer by describing it as the "selected" form. * get_url -> url property This is just an elimination of the get_ prefix and use a property. For backwards compatibility, the older method names remain as aliases.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I've always been a little bothered having to write
browser.get_current_page()
andbrowser.get_current_form()
. They're quite lengthy.With
browser.get_current_page()
, I imagine thatget_page
would suffice (and perhaps there are even shorter aliases we could entertain). There really is not ever another page, so "current" is a superfluous adjective.With
browser.get_current_form()
, if we're being verbose, thenget_selected_form
seems like it would be more correct and also less confusing to users. However,get_selected_form
is quite lengthy as well, and I'm not convinced thatget_form
is suitable due to the (rightful) existence ofselect_form
.The text was updated successfully, but these errors were encountered: