Data may be class data or object data. Naming conventions are used to describe data that is not directly accessible from outside the class.
- Data may be associated with a class or an object…and it's important to understand the distinction.…Here in Komoide I've opened a working copy of variables.py…from chapter nine of the exercise files.…And here in the init method, which is our constructor…you notice that I'm initializing three different variables…type, name, and sound.…And these are object variables.…They only exist, when the object is created from the class…they do not exist in the class itself.…
And so, I'm going to go ahead and run this…and you can see where using those variables…but what's important to realize here is that if I come in…and I change one of them,…a zero name…= 'Joe'…Now this is not a good idea, and you don't normally want…to access these underscore variables directly.…The underscore means don't do that.…And so I'm just doing this for demonstration purposes.…So that we can see that when I print…a zero dot name…I'm going to move this stuff to the end here…Oops, copied it, I didn't move it, there we go.…
So you see that a zero name is 'Joe', and a one name did not…
- 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.