Search code examples
pythonpython-3.xlinter

Python warning print expression is assigned to nothing


I'm using Syntastic in vim as a linter for Python3. I have a few warnings that my print statements are expressions that are not assigned to anything:

[expression-not-assigned] Expression "(print(('Authenticated for Twitter user ') + (twitter_api.VerifyCredentials().screen_name)), )" is assigned to nothing
[expression-not-assigned] Expression "(print('Deleting Twitter posts.'),     )" is assigned to nothing

These are just simple print statements so I'm curious why I'm seeing these warnings and how I would go about resolving them.


Solution

  • Remove the outer parenthesizes and everything should be fine.

    print('Authenticated for Twitter user %s' % twitter_api.VerifyCredentials().screen_name)
    print('Deleting Twitter posts.')