Ignoring flake8 E741 rule

On new version of flake8, the rule E741 has been implemented. We have a lot of code which use l as list comprehension variable (when iterate on lines).
Personally I do not find those rules relevant because the similarity between the letters depend a lot of the font used. For example I use the Liberation Mono for which the I is quite different from the l and 0 has a dot in the middle to distinct from O. But other fonts may make other letter appears similar. I think it is the responsibility of the developer to choose a good font for coding.
So I propose to make reviewbot ignoring this rule.

1 Like

Makes sense for me.
I prefer to ignore the rule than changing all l to lines which will be hard and it may lead to some errors.

I have no problem with l when it is used in list/set/dict comprehensions. I think a combination of the small scope it is used in, and the fact that it is often seen along with an attribute (e.g.: l.debit) means that it is pretty hard to misread it as a 1, regardless of which font it is in. I can understand the concern behind rule E741, but list comprehensions are meant to be concise and for me it makes sense to use l as the abbreviation of line, rather than some other random letter.

It does look like it is used in some other places, and I may be in favour of updating some of these to use more descriptive variable names, but only if it doesn’t affect how readable the code is.

I agree that variables with a scope larger than a x-comprehension should not be of one symbol (except for index loop like i and j).
I do not think we need to update the cases you find just for the sake of following the rule. But if there is another change impacting them, we should take the chance to change them.

1 Like

So I updated the website and updated the flake8 configuration of reviewbot.

Hello,
As per the previous update from updated from flake8 configuration of reviewbot. The patch reload https://codereview.tryton.org/292421003/#ps310751002, => (ambiguous variable name ‘l’) is the expected response from reviewbot.

Or this has nothing to do with it?

Should we update the .flake8 file of each repository?

Indeed I need to update .flake8 of all repositories.