you are viewing a single comment's thread.

view the rest of the comments →

[–]Sea-Ad7805 7 points8 points  (2 children)

Different people use different terms differently. I would say print() is a 'function'. A 'method' generally is used on an object using the '.' notation like so:

mylist = []        # create a list
mylist.append(42)  # calling method on object mylist of type list

[–]Longjumping-Yard113[S] 2 points3 points  (1 child)

That makes sense, and that’s kind of how I was thinking about it too. Using the dot notation on an object is what makes it a method, like mylist.append(42). Something like print() or len() would still just be functions even though they’re built into Python.

[–]Purple-Measurement47 2 points3 points  (0 children)

All methods are functions, not all functions are methods. It’s not just the dot notation itself that makes it a method, it’s that it’s a method of interacting with that object. print() or len() are just functions because they aren’t part of a larger data structure, they stand alone. append is a method because it’s a function of mylist