CS 3101-1 - Programming Languages: Python

Object Oriented Python

Modules

CS 3101-1 - Programming Languages: Python

Lecture 3: OOP, Modules, Standard Library I

Daniel Bauer (bauer@cs.columbia.edu)

October 1 2014

Daniel Bauer

CS3101-1 Python - 03 - OOP/Modules and Packages

1/29

Object Oriented Python

Modules

Contents

Object Oriented Python

Modules

Daniel Bauer

CS3101-1 Python - 03 - OOP/Modules and Packages

2/29

Object Oriented Python

Modules

Object Oriented Python

Modules

Daniel Bauer

CS3101-1 Python - 03 - OOP/Modules and Packages

3/29

Object Oriented Python

Modules

Object Oriented Programming in Python

I

Object Oriented Programming (OOP) is at the core of

Python.

I

I

I

I

Everything is an object!

Operations are methods on objects.

Modularization.

We have seen examples of objects already:

I

I

Objects of built-in data types (int, str, list, dict ... ).

Functions.

I

Can create our own types (classes).

I

Python does not enforce OOP (unlike Java), but we need to

understand at least what is going on.

Daniel Bauer

CS3101-1 Python - 03 - OOP/Modules and Packages

4/29

Object Oriented Python

Modules

Objects, Attributes, Methods, Classes

I

Classes:

I

I

User defined types of objects (including their methods,

attributes, relations to other objects).

Can be instantiated into an object / is a ¡®blueprint¡¯ that

describes how to build an object.

Knights can eat, sleep, have a favorite color, and a title.

Daniel Bauer

CS3101-1 Python - 03 - OOP/Modules and Packages

5/29

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download