Back to search

What is monkey patching?

Monkey patching replaces attributes at runtime, often for tests or temporary overrides.

Python Medium Theory

What is monkey patching?

Monkey patching replaces attributes at runtime, often for tests or temporary overrides.

  • Changes behavior dynamically
  • Useful in tests
  • Can make code harder to reason about

What is monkey patching?