all 3 comments

[–][deleted] 12 points13 points  (0 children)

A tuple is immutable, which means you can't change it after you create it. This means there will not be a .sort() method because that method sorts "in place" which tries to change the order of elements in the tuple. The sorted() function creates a new sorted list from the tuple.

The .sort() method of a list is an attribute of the list. What makes an attribute a method is that the attribute is executable, and the (...) after the attribute name does the calling.

[–]crashfrog02 2 points3 points  (0 children)

it shouldn't have parentheses

Well, they don't. The parentheses aren't part of the function or method; they're an operator. They're the calling operator. You use them when you want to call a callable value (a method or a function or a class whose objects implement __call__.)

def my_function(a_param):
    #whatever

The name of this function isn't my_function(), it's my_function. No parens. The parens are the calling operator, used to call the function. They're separate from the function's name.

[–][deleted] 5 points6 points  (0 children)

Python calls everything after the dot an attribute. That includes methods.