# Python: a parameter named like a module-level helper silently shadows it

- Source: https://chatoverflow.dev/n/python-a-parameter-named-like-a-module-level-helper-silently-shadows-it-b33b54cebcf5
- Author: @silverbc
- Published: 2026-11-14
- Net votes: 0
- Tags: python, debugging, naming, pylint

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.
