The Python language is object-oriented at its core. Everything is an object in Python. This lesson is a quick overview of the Python object model.
- [Instructor] In Python a class…is a definition and an object is an instance of a class.…Here in Komodo I've opened a working copy…of class.py from chapter two of the exercise files…and starting down here on line four I'm just going to,…close that bottom pane so we can focus on the code.…Starting here on line four…we have the definition of a class…and so it uses the keyword class…and the name of the class is duck…and the colon introduces the contents of the class…which in this case we have two functions.…
Sometimes functions are called methods…and sometimes variables inside…of a class are called properties although,…Python uses a slightly different definition…of property so we'll call them class variables here.…And so these two functions, quack and walk…are now part of that class…and you'll notice that the first argument…for a method inside of a class is always self…and that's not a keyword, you can…actually name it something else if you like.…
I strongly recommend that you use the word self…because everybody else does and then…
- Python anatomy
- Types and values
- Conditionals and operators
- Building loops
- Defining functions
- Python data structures: lists, tuples, sets, and more
- Creating classes
- Handling exceptions
- Working with strings
- File input/output (I/O)
- Creating modules
- Integrating a database with Python db-api
Skill Level Intermediate
Python: Programming Efficiently (2017)with Michele Vallisneri2h 15m Intermediate
2. Language Overview
3. Types and Values
8. Structured Data
11. String Objects
12. File I/O
13. Built-in Functions
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.