[High Scores]: Improve Test Cases / Exercise for Mutability Discussions
See original GitHub issueI just did this exercise in php and python and I think that the Python version would require some improvement. I would like to discuss if it makes sense and eventually contribute via PR.
explanations
When you jump in the exercise, the explanation are very small. the user faces 4 functions and without looking at the test I would have never understood what the last were about (https://github.com/exercism/python/blob/main/exercises/practice/high-scores/high_scores.py).
def latest(scores):
pass
def personal_best(scores):
pass
def personal_top_three(scores):
pass
def latest_after_top_three(scores):
pass
def scores_after_top_three(scores):
pass
In some exercises there is a complete description of the tasks and in other the function objective is described in the docstring (or bot). Would it make sens to add this for this exercise?
latest_after_top_three
and scores_after_top_three
I think these 2 functions are perfectly useless in Python. I actually validated the tests (https://github.com/exercism/python/blob/79515ffbee47c1cff2d625c363592b3d73357513/exercises/practice/high-scores/high_scores_test.py#L50) with the following:
def latest_after_top_three(scores):
return latest(scores)
def scores_after_top_three(scores):
return scores
From what I did in php I think that these function reflect the C like behavior where passing scores
by reference in the latest or personal-top-three function could have altered the initial scores
list.
So instead of having these functions, I think it would make more sense to test the scores
variable after running personnal_top_three
.
let me know what you think and more importantly let me know if I’lm wrong.
PS: As mentioned at the top of the issue I’m happy to contribute
Issue Analytics
- State:
- Created 2 years ago
- Comments:13 (11 by maintainers)
Top GitHub Comments
Closing, as #3013 and #3016 are merged.
I think this exercise could be super useful for mutability, unfortunately, I’m swamped in webinars for work and preparation is so much time-consuming…
Thanks a lot for your PR and I agree we should leave it open, at some point I’ll have time to breath and work a PR for this exercice!