Python With Spyder 8: Python Objects Part 1

This is the 8th in a series of videos providing a tutorial on Python 2.7 using Anaconda Python and the Spyder IDE. Click here to go to a “home page” for the video series.

This video is the first of four videos on introducing objects in Python. This video covers the basic idea of using the class statement to create objects in Python and then goes on to show how to create objects using the __init__( ) function to dynamically create object attributes.

The source code used in this video can be found here. You can right click on the link and use “Save As” to save the file.

Note: The source code files are plain text files with a “.txt” extention. You will probably want to change the extensions to “.py” after you download them. If you do so, please be aware that if you have Python installed, the file will become executable, so that it will run if you click on it (accidentally or otherwise).

The video is about 23 minutes long.

PWS8-DSSThumb

Next Video: Attributes and Methods

Video Index: Python Objects Part 1

Click on the topics below to jump to that location in the video.

Time Topic
00:00Introduction and Continuation of the Example of Products in a Grcery Store
00:14The data for every product
01:21Create Object for the product Skim Milk
01:39The Python Class statement
01:51The Class Statement Ends in a Colon
02:12Specifying Attributes
04:32The Error Triangle in the Spyder Editor
05:31Executing the Class Statement
06:00Referenceing Object Attributes
07:17The Problem with the Manual Specification of Objects
07:52The Need for an Object Template Approach
08:31Discussion of the Need for Object Constructors
11:05Class Statement for an Object Constructor
11:17The __init__() function to initialize objects
11:47The Reference to Self In the __init__() function
12:41The colon (“:”) at the end of the __init__() function definition
12:58Indentation for the __init()__ function\
13:09Creating Variables using the –init__() function and self
15:07Creating an instance (using the __init__() function and self)
16:18Summary of Object Creation So Far
16:34Executing the Class Statement
16:52Creating an instance (using the __init__() function and self)
17:22Reference Object Attributes
18:08Write the code to creating a second instance
19:34Create the second instance
19:47Reference the Attribues of the Second Instance
20:15Summary of Object Creation So Far
21:37Self is Omitted from the Call to the Object Creator
22:13Summary

Next Video: Attributes and Methods

1 thought on “Python With Spyder 8: Python Objects Part 1

Leave a Comment

Time limit is exhausted. Please reload CAPTCHA.