Pychecker issues this warning:
Using a conditional statement with a constant value (create)
for this statement:
"action:" + ((exists and "create") or
((not exists) and "delete"))])
To me, this expression seems to be idiomatic Python using the fact that Python returns the last evaluated item from a logical expression. Its purpose is simply to return either "action:create" or "action:delete" depending on the value of exists, perhaps not the best idiom but not as far as I can see either wrong or especially un-Pythonic.
What exactly is the warning trying to say?
Of course the warning was useful as it made me reconsider and now I have:
"action:" + (exists and "create" or "delete")
which is more Pythonic I think and also does not trigger any warnings.
However, the question remains: what does the warning really mean?
Log in to post a comment.