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