Python: In Python, which comparison about Mutable Default Arguments is accurate?

Difficulty:

Easy

Questions:

1

Time Limit:

2 minutes

Passing Score:

100%

Question

In Python, which comparison about Mutable Default Arguments is accurate?

  1. There is no practical difference in behavior, performance, or maintainability when Mutable Default Arguments is involved.
  2. The oldest option related to Mutable Default Arguments is always the right production choice regardless of workload or context.
  3. An immutable default such as None is usually a safe placeholder, while a mutable default such as [] can leak state across calls.
  4. Differences around Mutable Default Arguments are mostly cosmetic, so correctness and debugging quality do not really change.

Hint

Focus on the behavior or tradeoff, not just the keyword.

Answer and rationale

Correct answer: C. An immutable default such as None is usually a safe placeholder, while a mutable default such as [] can leak state across calls.

An immutable default such as None is usually a safe placeholder, while a mutable default such as [] can leak state across calls. This is the comparison that usually separates memorization from understanding.

Track: Python