You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
example.py:23: error: Attempted to reuse member name "i" in Enum definition "Slot" [misc]
Now, I am trying to reuse the member name; in contrast to the Enum example, I have multiple loops that generate several sets of Enum values, and I am reusing the same loop variable across all of them (see the example below). mypy doesn't complain if I only have one loop in my Enum.
But considering I've already declared that member to be ignored in _ignore_, I don't see why I should use multiple distinct loop variables for all my loops, if all of them are going to be ignored by Enum plumbing anyway.
Moreover, the loop variable is used in a loop anyway; it will definitely get reassigned multiple values even during the first loop execution. I don't see how having multiple loops makes any difference to having a single loop.
I'm trying to follow the dynamic generation of Enum values example as described in the Enum documentation, and I'm getting this from
mypy
:Now, I am trying to reuse the member name; in contrast to the Enum example, I have multiple loops that generate several sets of Enum values, and I am reusing the same loop variable across all of them (see the example below).
mypy
doesn't complain if I only have one loop in my Enum.But considering I've already declared that member to be ignored in
_ignore_
, I don't see why I should use multiple distinct loop variables for all my loops, if all of them are going to be ignored by Enum plumbing anyway.Moreover, the loop variable is used in a loop anyway; it will definitely get reassigned multiple values even during the first loop execution. I don't see how having multiple loops makes any difference to having a single loop.
To Reproduce
Run source through
mypy
:Expected Behavior
mypy
should not complain about this code.Actual Behavior
mypy
complains about the member being reused at the line of the second loop.Your Environment
mypy.ini
(and other config files):The text was updated successfully, but these errors were encountered: