question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Making the Grade] Union return type in Task 6

See original GitHub issue

https://github.com/exercism/python/blob/650a597311104f94f5c807a68c7859e16dc76327/exercises/concept/making-the-grade/loops.py#L51

IMO the union return type is not needed in a concept exercise. Besides, I don’t see the value it provides at all in the current setting because <student name> is the only unique part that is matched.

My suggestion is to have a str return type, i.e.:

    :return: str - name of the first student with a perfect score or 'No perfect score.' if not found.

Happy to submit a PR.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
pranasziaukascommented, Oct 18, 2021

I expect to pick this right after #2668 is merged (or dismissed).

1reaction
BethanyGcommented, Oct 16, 2021

No @pranasziaukas – I don’t think you are overthinking it. (Perhaps I was when making the exercise & deciding to include nested data structures…but that’s a wholly different story…) 😄

I think the real problem is that there aren’t strong standards or practices around this. Python is dynamically/duck typed, and functions return objects, typing TBD. There are conventions (and hints), and they vary by programmer, team and project. It’s an architecture and design discussion. That doesn’t mean I am arguing for arbitrary multi-return types – just that the concern is most often in a context of how an overall program or application is built and used.

So I don’t really think it is a big deal to have type mis-match here where the code is isolated and focused on a specific concept like loops. And yes, that probably makes me a naughty Pythonista. 😄

TL;DR I can certainly live with changing it to

:return: first `[<student name>, 100]` or `[]` if not found.

and might even propose that it be amended somewhat to: :return: first `[<student name>, 100]` or `[]` if no student score of 100 is found.

Let’s just make sure that the instructions, examples, docstrings, et. al. are checked to make sure that the change is clear to students.

And thank you both for discussing this. 💜

Read more comments on GitHub >

github_iconTop Results From Across the Web

C# how to combine 2 Task<IEnumerable<T>> via Union and ...
If the IEnumerables weren't wrapped in Tasks, of course I would just do: var ResultC = ResultA. Union(ResultB); How can I accomplish this...
Read more >
Handbook - Unions and Intersection Types - TypeScript
A union type describes a value that can be one of several types. We use the vertical bar ( | ) to separate...
Read more >
Union 6th/7th Grade Center Home - Union Public Schools
We welcome all sixth and seventh grade students and their parents! The 6th/7th Grade Center ... Return in person to the Union 6th/7th...
Read more >
6. Compounding Rules A compound word is a union of two or ...
When com- pound words must be divided at the end of a line, such division should be made leaving prefixes and combining forms...
Read more >
Common Abbreviations & Acronyms Used In Workers ...
Estimated Return To Work/Early Return To Work. 5020. Employer's First Report of Work Injury (Form #). F & A ... Workers' Compensation Insurance...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found