Trying to fill the empty nested lists with the value, I found there is distinct behavior between using the for loop vs list comprehension, and I was wondering why this is, despite functionally they should do the same. See below:
nl= [[True], []]
for item in nl:
if len(item) ==0:
item.append('false')
#this is the desired result
print(nl)
[[True], ['false']]
nl=[item.append('false') for item in nl if len(item)==0]
print(nl)
[None]
#no idea why this happens
print([item.append('false') for item in nl if len(item)==0]
print(nl)
[[True], ['false']]