Open Pierre-Sassoulas opened 2 years ago
Thanks! I wonder why it didn't flag that on my test cases then. I'll have another look
It might be because this needs to be activated explicitly (it's an extension). The conversation is long but should clear up the reasoning behind the use-set-for-membership
message that was added alongside it.
Maybe the README should be updated.
In the README of perflint
:
Constructing a tuple is faster than a list and indexing tuples is faster. When the sequence is not mutated, then a tuple should be used instead.
vs. on the website of pylint
:
Only for style consistency! Emitted where an in-place defined
list
can be replaced by atuple
. Due to optimizations by CPython, there is no performance benefit from it.
https://pylint.pycqa.org/en/latest/messages/refactor/consider-using-tuple.html
There was a discussion about the performance benefits and we concluded that it's a style check and not a performance check. Feel free to chime in :)
For reference I'm trying to integrate the check in pylint here: https://github.com/PyCQA/pylint/pull/6078