Edited in response to your indication It is said that it can be inverted and stored in a variable with not without returning. In other words, it was OK below. .. ..
python.py
li = []
result = bool(li)
turned_result = not bool(li)
print('result: ',result)
print('turned_result: ',turned_result)
# result: False
# turned_result: True
python.py
li = []
result = bool(li)
turned_result = (lambda x: not bool(x))(li)
print('result: ',result)
print('turned_result: ',turned_result)
# result: False
# turned_result: True
Recommended Posts