- Let's start by looking at the namedtuple.…Now some people say toople, some people say tuple.…Tomato, tomato, it doesn't really matter.…I call them tuples.…Now, suppose I wanted to define a data structure…to represent a geometric point on a typical x and y axis.…Now, I could easily do this by defining…a regular tuple with two elements,…the x and y values of the point.…Now, to access these values I can use…positional argument indexes to get each one.…Now, this may seem all fine and good,…but as my program becomes more complex…this kind of code easily looses its meaning…and becomes hard to read.…
Especially, if I don't keep the names of all…the point variables clear and meaningful.…And maybe you can do it on your own,…but your colleagues might not do it,…so the code could get pretty hard to read after awhile.…Now, I could just define a Python class…and give it member properties for x and y…and then write getattr and setattr functions…and so on,…but that seems a little much…for a relatively simple data structure.…
- Truth value testing
- Template strings
- Advanced Python functions
- Advanced collections
- Advanced classes and objects
- Python comprehensions: list, dictionary, and set
Skill Level Advanced
1. Python Language Features
2. Built-In Functions
3. Advanced Python Functions
4. Advanced Collections
5. Advanced Classes and Objects
6. Using Logging
7. Python Comprehensions
- 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.