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
#!/usr/bin/env python2
'''
A bug in pylint.
'''
import sys
def main():
'''Demonstrating the bug.'''
options = []
if len(sys.argv) > 1:
options = [["Woof!"]]
else:
options = [["Barf!"]]
print('Why is this bad? {options[0][0]}'.format(options=options))
print("It's clearly a bug, since pylint thinks this is fine:", options[0][0])
if __name__ == "__main__":
main()
PCManticore
changed the title
False positive - correct construct works inside print, but not inside .format
invalid-format-index false positive
Feb 17, 2019
The issue is NOT fixed on the preview release.
Steps to reproduce
Current behavior
Expected behavior
There is no bug here - and pylint reports nothing for the print command that follows, that uses exactly the same construct (
options[0][0]
).pylint --version output
But also with the current version that pip3 installs:
The text was updated successfully, but these errors were encountered: