I was working on some code when I ran into a little problem. I orginally had something like this:
if myList is []:
# do things if list is empty
else:
# do other things if list is not empty
When I ran the program (and had it so myList was empty), the program would go straight to the else statement, much to my surprise. However, after looking at this question, I changed my code to this:
if not myList:
# do things if list is empty
else:
# do other things if list is not empty
This made my program work as I'd expected it to (it ran the 'if not myList' part and not the 'else' statement).
My question is what changed in the logic of this if-statement? My debugger (I use Pycharm) said that myList was an empty list both times.