Skip to content
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

Closed
hemberger opened this issue Dec 7, 2017 · 3 comments
Closed

Shorter getter names #175

hemberger opened this issue Dec 7, 2017 · 3 comments
Assignees
Labels

Comments

@hemberger
Copy link
Contributor

I've always been a little bothered having to write browser.get_current_page() and browser.get_current_form(). They're quite lengthy.

With browser.get_current_page(), I imagine that get_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, then get_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 that get_form is suitable due to the (rightful) existence of select_form.

@moy
Copy link
Collaborator

moy commented Dec 7, 2017

Actually, we could/should even use Python's @property and avoid getters right away.

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`.
@hemberger hemberger self-assigned this Jan 5, 2018
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.
@moy moy closed this as completed in 790b118 Aug 14, 2019
@hemberger
Copy link
Contributor Author

I believe this was unintentionally closed.

@hemberger hemberger reopened this Aug 26, 2019
@moy
Copy link
Collaborator

moy commented Aug 26, 2019

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.
@moy moy closed this as completed in 811b4a5 Sep 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants