Open jpy-git opened 2 years ago
I think the best way to resolve this is to just mark all logical_line
s with an '=' that has a 'lambda' at some point after it as having a lambda assignment. This covers all cases here and I can't think of any additional unwanted cases that this would include (as long as it is not an assignment operator or function declaration annotation, but these already checked and excluded). I'll make a PR implementing this.
I think the best way to resolve this is to just mark all
logical_line
s with an '=' that has a 'lambda' at some point after it as having a lambda assignment.
mapped = map(lambda i: i * 2, range(10))
would also be matched by this when it shouldn't, if I understood you correctly?
Oh, you're right it is not as simple as what I had said.
mapped = map(lambda i: i * 2, range(10))
In addition to this,
f.method = lambda: 'Method'
and
f['a'] = lambda x: x ** 2
both should be allowed according to tests/E73.py Nonetheless, I came up with a regex that should only search for actual lambda assignments (making sure to account for all of the examples above). Additionally, regex is a more elegant solution than the way it was already being implemented. Making a PR.