Learn your way! Get started

Python 3, Part 4 of 6: Functions and Classes

with expert Peter Thorsteinson


Watch trailer


Course at a glance

Included in these subscriptions:

  • Dev & IT Pro Video
  • Dev & IT Pro Power Pack

Release date 9/3/2014
Level Beginner
Runtime 1h 45m
Closed captioning Included
Transcript Included
eBooks / courseware Included
Hands-on labs N/A
Sample code Included
Exams Included


Enterprise Solutions

Need reporting, custom learning tracks, or SCORM? Learn More



Course description

In this course we’re going to start with a look at Functions and Functions are particularly important in Python, because one of the strengths of Python is the fact that it is a functional language. We'll start off by taking a look at the Def key word. That's how you define a Function. Next we’ll look at Default Arguments, Doc Strings, Variadic Functions, and Factorial. Then we will move onto some of the more advanced topics. We will talk about Function Objects. Then we will talk about Lambda expressions, which are a particularly compact representation for a function. Then we will go onto Generators, which are a more sophisticated example of the kinds of things you can do with Functions and then we’ll move onto Closures. Next we are going to talk about Classes, and the concept of a class is basically the idea of a programmer defined data type that you can define within your application. So after we are finished talking about how to define a class, we are going to talk about how to implement the code that is responsible for initializing a new instance of that class, which is Object Initialization. Then we will work on Classic Static Members that we can define that are associated with the class as a whole, rather than a particular instance of that class. And then we'll talk about Class Inheritance and then the final important aspect of object oriented programming that we will take a look at is something known as Data Hiding.

Prerequisites

This course teaches anyone who is interested in learning the basics of programming computers using Python 3. This course has no programming language pre-requisites and only assumes the basic familiarity with computer usage that virtually everybody has. Anyone with moderate computer end-user experience should be able to take this course.

Learning Paths

This course is part of the following LearnNowOnline SuccessPaths™:
Python Development

Meet the expert

Peter Thorsteinson has been working for two decades in many areas of Microsoft-based software development technologies, including all the latest languages, frameworks, and tools. He has been involved in several large scale software development projects and has authored and co-authored several books and courses relating to ASP.NET, AJAX, JavaScript, WPF, WCF, WF, ADO.NET, and LINQ. Peter is currently focusing on ASP.NET MVC, jQuery, Task Parallel Library, Windows Azure, and SharePoint Development.

Course outline



Functions

Definitions (02:15)
  • Introduction (00:12)
  • The def Keyword (01:07)
  • Demo: The def Keyword (00:49)
  • Summary (00:06)
Functions (06:29)
  • Introduction (00:30)
  • Simple Functions (02:22)
  • Demo: Functions (03:23)
  • Summary (00:12)
Default Arguments (05:55)
  • Introduction (00:22)
  • Default Arguments (02:48)
  • Demo: Default Arguments (02:16)
  • Summary (00:28)
Doc Strings (05:55)
  • Introduction (00:45)
  • Doc Strings (02:43)
  • Demo: Doc Strings (02:07)
  • Summary (00:19)
Variadic Functions (06:43)
  • Introduction (00:21)
  • Variadic Functions (01:50)
  • Demo: Variadic Functions (04:10)
  • Summary (00:20)
Factorial (06:42)
  • Introduction (00:42)
  • Factorial Function (00:41)
  • Demo: Factorial Function (04:53)
  • Summary (00:25)
Function Objects (07:03)
  • Introduction (00:58)
  • Function Objects (03:10)
  • Demo: Function Objects (02:28)
  • Summary (00:25)
Lambda (10:34)
  • Introduction (00:36)
  • Lambda Expressions (02:36)
  • Demo: Lambda Expressions (07:06)
  • Summary (00:15)
Generators (06:02)
  • Introduction (00:32)
  • Generators (02:32)
  • Demo: Generators (02:35)
  • Summary (00:22)
Closures (10:01)
  • Introduction (01:05)
  • Closures (04:46)
  • Demo: Closures (03:47)
  • Summary (00:21)

Classes

Classes (09:30)
  • Introduction (00:55)
  • Defining Classes (04:08)
  • Demo: Classes (04:07)
  • Summary (00:19)
Object Initialization (04:58)
  • Introduction (00:25)
  • Object Initialization (01:59)
  • Demo: Object Initialization (02:19)
  • Summary (00:14)
Class Static Members (06:55)
  • Introduction (00:38)
  • Class Static Members (02:02)
  • Demo: Class Static Members (03:59)
  • Summary (00:14)
Class Inheritance (09:35)
  • Introduction (00:42)
  • Class Inheritance (03:28)
  • Demo: Class Inheritance (04:33)
  • Summary (00:50)
Data Hiding (06:53)
  • Introduction (01:14)
  • Data Hiding (02:11)
  • Demo: Data Hiding (03:12)
  • Summary (00:14)