Chapter 7Using Methods

So far we’ve seen lots of functions: built-in functions, functions inside modules, and functions that we’ve defined. A method is another kind of function that is attached to a particular type. There are str methods, int methods, bool methods, and more—every type has its own set of methods. In this chapter, we’ll explore how to use methods and also how they differ from the rest of the functions that we’ve seen.

Get Practical Programming, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.