avoid unreachable code

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