Refactor a Messy Python Function

Anthropic Claude Code

Submit a prompt

Overview

Refactor a messy Python function while preserving behavior.

Use cases

Prompt
Copied 0
Refactor this messy Python function to be clearer and safer while preserving behavior.

Deliver:
1) Refactored code
2) List of behavior-preserving changes
3) Residual risks / TODOs
4) 3 unit tests (pytest) covering edge cases

CODE:
<<<paste>>>

Can AI?

Alternatives