Redefining built-in 'map'
254
255 # pylint: disable=redefined-builtin
256 def format_map(
257 self, map: Mapping[str, Any] # type: ignore[override] # noqa: A002258 ) -> Self:
259 formatter = _MarkdownEscapeFormatter(self.escape)
260 return self.__class__(formatter.vformat(self, (), map))
Description
Defining a local variable or function with the same name as a built-in object makes the built-in object unusable within the current scope and makes the code prone to bugs.
Bad practice
dict = {} # dict is a Python builtin!
for idx, student in enumerate(students):
dict[student] = idx
Preferred:
roll_number = {}
for idx, student in enumerate(students):
roll_number[student] = idx