You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Concept Exercises are quite different from the "regular" practice exercises that were carried over from V2. They're intended to teach a specific concept, and must only use the concepts introduced as part of their dependency tree. Since this concept exercise is designed to teach conditionals, we can't (even though bools is covered first) have the exemplar.py showing the return of a bool, and not showing if, elif, and else in action.
I am happy to have someone propose revisions / additions to this exercise provided that it thoroughly covers the use of if, elif, else and only use the techniques taught in basics (Guidos Gorgeous Lasagna) and bools (Ghost Gobble Arcade Game). But I do think it's (with the changes below) decent as it stands.
Having said that - agree that multiple returns here is not ideal -- especially when it pisses off PyLint. To that end, I've re-written the exemplar.py file in PR #2556 to use a variable for return instead.
Having said that - agree that multiple returns here is not ideal -- especially when it pisses off PyLint. To that end, I've re-written the exemplar.py file in PR #2556 to use a variable for return instead.
PyLint is wrong in this instance. Multiple return statements is the right thing to do.
I've merged #2556.
IMO, this has made things worse. I will suggest something different.
I agree with this as long as the items are bools.
What if a is an integer, or list, or something that has an implicit boolean meaning? 5 or False returns 5, not True, but the above mentioned if structure does return True. While one can achieve the same with bool(5) or False, it might be a bit confusing for a beginner.
I would not simply discard the good old if. But yes, there is definitely space for a lesson with an advanced boolean handling (including the short-circuits, implicit meanings, one line returns etc).
I am going to close this issue. The tasks in this exercise are being reviewed/revised, but we are unlikely to change Task 1 to not use an if. We may revisit this in the future, but we need to keep this exercise focused on the use of conditionals (not Booleans) for now.
Activity
BethanyG commentedon Sep 6, 2021
@punkstarman 👋🏽 Thanks for logging this.
Concept Exercises are quite different from the "regular" practice exercises that were carried over from V2. They're intended to teach a specific concept, and must only use the concepts introduced as part of their dependency tree. Since this concept exercise is designed to teach
conditionals, we can't (even thoughboolsis covered first) have theexemplar.pyshowing the return of abool, and not showingif,elif, andelsein action.I am happy to have someone propose revisions / additions to this exercise provided that it thoroughly covers the use of
if,elif,elseand only use the techniques taught inbasics(Guidos Gorgeous Lasagna) andbools(Ghost Gobble Arcade Game). But I do think it's (with the changes below) decent as it stands.Having said that - agree that multiple
returnshere is not ideal -- especially when it pisses offPyLint. To that end, I've re-written theexemplar.pyfile in PR #2556 to use a variable forreturninstead.BethanyG commentedon Sep 6, 2021
I've merged #2556. Please let me know if you have further questions/issues/comments. Thanks!
punkstarman commentedon Sep 7, 2021
PyLint is wrong in this instance. Multiple return statements is the right thing to do.
BethanyG commentedon Sep 7, 2021
Suggest away! PRs on this welcome, with the caveats listed above. 😄 I will hold this issue open, and flag it as a discussion.
kbuc commentedon Sep 9, 2021
I agree with this as long as the items are bools.
What if
ais an integer, or list, or something that has an implicit boolean meaning?5 or Falsereturns 5, notTrue, but the above mentionedifstructure does returnTrue. While one can achieve the same withbool(5) or False, it might be a bit confusing for a beginner.I would not simply discard the good old
if. But yes, there is definitely space for a lesson with an advanced boolean handling (including the short-circuits, implicit meanings, one line returns etc).punkstarman commentedon Sep 9, 2021
Absolutely
I do not mean to discard it. I mean to make proper use of it in context.
BethanyG commentedon Sep 17, 2021
I am going to close this issue. The tasks in this exercise are being reviewed/revised, but we are unlikely to change
Task 1to not use anif. We may revisit this in the future, but we need to keep this exercise focused on the use of conditionals (not Booleans) for now.