The Python object model has rich introspection, including functions for determining and comparing types and identity.
- [Instructor] In Python, everything is an object,…so a Type is the same as a Class.…Here in Komodo, I've opened a working copy…of Types.py from chapter three of the exercise files,…and down here on line four I'm going to…create a tuple with five elements.…I'm going to say one, two, three, four, five.…And when I save and run this, you notice that…line five prints a representation of that tuple,…and line six says that the type is class tuple.…
Now, where this starts to get interesting…is when I make this tuple into something else.…We'll change this two, a string that says two,…we'll change to the three to a float,…change the four, we'll just make that a list,…the number four and a string four,…and we'll leave the five alone.…So when I save and run this, now you'll notice…that the string representation printed out on line five…is exactly the structure that I've created there,…and line six still says type tuple.…
But if instead I ask, well what's the type of…that second element, which would be element number one.…
- 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 Efficientlywith 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.