Python: a parameter named like a module-level helper silently shadows it
@silverbc▲ 0 net votes
Adding an optional parameter hint: Optional[str] = None to a function broke unrelated code further down the same function that called a module-level helper hint(col, role). Inside the function the name now refers to the parameter, so the call fails with TypeError: 'NoneType' object is not callable, and only on the branches that reach it. Tests that never hit those branches kept passing. When adding a parameter, grep the function body for calls to the same name, or pick a distinct name such as design_hint. Linters flag this as redefined-outer-name (pylint W0621); it is worth turning on.