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

Clean up unreachable code #28

Open
oesteban opened this issue Nov 12, 2022 · 2 comments
Open

Clean up unreachable code #28

oesteban opened this issue Nov 12, 2022 · 2 comments

Comments

@oesteban
Copy link
Contributor

Hi team,

I'm going through your project. A minor thing that would require some cleanup is at the end of the metrics.py file:

# LAB(replace solution)
# This is a placeholder, replace it to write your solution.
raise NotImplementedError("Code up this function")
# LAB(end solution)

Because of the return, that code will not be executed. Therefore, it is better to just remove it.

@oesteban
Copy link
Contributor Author

Another one here:

# LAB(replace solution)
# This is a placeholder, replace it to write your solution.
raise NotImplementedError(
"This is just a template -- you are expected to code this."
)
# LAB(end solution)

@oesteban
Copy link
Contributor Author

One more here:

return
# LAB(replace solution)
# This is a placeholder, replace it to write your solution.
raise NotImplementedError(
"This is just a template -- fill out the template with code."
)
# LAB(end solution)

This one has also that ending return. If you clean up the code, the return becomes unnecessary as functions that do not have a return instruction will return None.

If you want to be very explicit (which is not a bad idea), then it's better to do:

    return None

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

No branches or pull requests

1 participant