This page is not yet available in Spanish. We are working on its translation.
If you have any questions or feedback about our current translation project, feel free to reach out to us!

Metadata

ID: python-best-practices/unreachable-code

Language: Python

Severity: Notice

Category: Best Practices

Description

Avoid unreachable code. If the code cannot be reached because of a coding mistake, fix the business logic. If the code should not be used, remove it.

Learn More

Non-Compliant Code Examples

def foo():
  return 3
  foo()  # unreachable code
  pass  # unreachable code

Compliant Code Examples

def foo():
	foo()
	pass
	return 3
https://static.datadoghq.com/static/images/logos/github_avatar.svg https://static.datadoghq.com/static/images/logos/vscode_avatar.svg jetbrains

Seamless integrations. Try Datadog Code Analysis

PREVIEWING: rtrieu/product-analytics-ui-changes