Bug in new `len()` refactor
Zac-HD opened this issue · 2 comments
Zac-HD commented
ls = [1, 2, 3]
maybe_num = None
num = maybe_num or len(ls)
In this case dropping the len()
is incorrect; there are presumably other similar cases still latent. CC @jakkdl
jakkdl commented
oh interesting, I had not considered this usage (and pretty much never use it myself). Yeah currently it will strip all len/bool inside BoolOps, but that's clearly not correct here - so should only strip len/bool if inside BoolOp that's inside an if
or similar.