list.append(val) returns None, which is Falsy, and so triggers or and returns the list. Nonetheless I consider this not pythonic, just make two separate lines without or
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?