list.pop and list.pop()
Difference between pop and remove
Videos
This feels like one of those python weird things. I am interested in explanations.
If I have a list=[1,2,3,4] and I do list.pop() the result is list=[1,2,3].
Perfect, just what I wanted.
However, if I am not careful and instead do list.pop--note there are no parentheses this time--I get no syntax error or warning and nothing happens, leading me to a strange debug session.
In the repl, if I do l.pop it just identifies it as a built-in method of list object at 0xwhatever. That's useful, but why is there not at least a runtime warning when I make this mistake in my code?
Can someone explain me what the difference between pop and remove is that makes sense? Why would you use pop over remove or vice versa?
Thanks!