list.append(val) returns None, which is a falsey value, so the value of the entire expression is list. If list.append returned a truthy value, that would be the value of the or expression.
While looking for how to allow list append() method to return the new list, I stumbled upon this solution:
list.append(val) or list
It's really nice and works for my use case, but I want to know how it does that.
how does "list.append(val) or list" work?