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

Fix if/elif/elif/... chains without else #25

Open
rbrito opened this issue Feb 8, 2012 · 3 comments · May be fixed by #91
Open

Fix if/elif/elif/... chains without else #25

rbrito opened this issue Feb 8, 2012 · 3 comments · May be fixed by #91

Comments

@rbrito
Copy link
Owner

rbrito commented Feb 8, 2012

The code has, in many places, many if/elif/elif/..., but they don't end with elses.

This is a sign of something fishy: at best, it confuses the reader that is left thinking: "why are the other cases not treated"; at worst, it leads legitimate bugs.

One quick'n'dirty, not-really-a-solution, measure is to give each such chains an else statement that simply logs things (using the logging infrastructure already in place) when things go wrong (so that we know that there are cases that we are not treating). This may be a measure for the short-term release of version 1.5.

Alternatively, in non-release versions, we can (and should) throw exceptions whenever something reaches such an else clause that we don't know yet how to treat, so that the problems become evident upon running the program and trying to get work done.

@markeyev
Copy link

Let me code it for you.

knittl added a commit to knittl/tunesviewer that referenced this issue Oct 24, 2020
Add logging after all if/elif chains to make it easier to catch coding
mistaks. Sometimes, doing nothing is the expected, so a simple comment
and a `pass` statement were added for these cases.
@knittl knittl linked a pull request Oct 24, 2020 that will close this issue
@asifurrahaman754
Copy link

hey is this solved? i would like to work on this

@programmin1
Copy link
Collaborator

hey is this solved? i would like to work on this

Look for "if" cases and log a warning/error in else case if applicable?

Honestly if you want to work on something I think porting it to all work on the latest Python3 would be a better use of time.

Please see this repo which is actually the main repo - https://github.com/programmin1/tunesviewer/tree/Python3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants