SlideShare a Scribd company logo
1 of 19
Presented by: Prithwish Chakraborty
LET’S CODE!!!
Sponsored by: AKAMAI
Reference: http://www.tutorialspoint.com/python/python_classes_objects.htm
 Python
 Variables:
 Basic data structures :
 Lists
 Dictionaries
 Tuples
 Basic operators:
 Addition/subtraction
 Division/Mutliplication
 Functions??
3/28/2013 1Let’s Code: Session 3
3/28/2013 2Let’s Code: Session 3
 Problem:
 Build an employee database
3/28/2013 3Let’s Code: Session 3
 Problem:
 Build an employee database
 What attributes do we want to keep?
 Employee Name: e.g. Sylvester Stallone
 Employee Address: e.g. (Beverly Hills, California, USA)
 Employee Id: e.g. 127001
 Employee Salary: e.g. $1000000
 What operations do we want?
 What other things can we do?
3/28/2013 4Let’s Code: Session 3
 Problem:
 Build an employee database
 What attributes do we want to keep?
 What operations do we want?
 Get Employee Name
 Get Employee id
 Change Salary
 Give 100$ bonus if address is in Beverly Hills
 Add a new information about the employee
 Add info about speciality e.g. “Mind Blowing Action Movies”
 What else can we do?
3/28/2013 5Let’s Code: Session 3
 Create an Employee:
 Which data structure to use ??
 Lets use dict
 Attributes:
3/28/2013 6Let’s Code: Session 3
Attribute Type Example
name string “Sylvester Stallone”
address tuple (“Beverly Hills”,”CA”,”USA”)
id int 127001
salary int 1000000
 Create an Employee:
 Functions:
 Now let us extend this to a database >
 Non-object oriented way
 Object Oriented way
3/28/2013 7Let’s Code: Session 3
Actions Example Logic
get_employee_name “Sylvester Stallone”
get_employee_id 127001
change_salary if(address[0] == “Beverly Hills”): salary += 100
Add_new_info Add attribute: Speciality
 Basic philosophy
 A “container” to hold attributes and operations realted
to those attributes in one single place!!
 Anybody having C background?? – lets start of by
thinking of struct: container to hold data
 How about if we have some funcitons?
 What you ask about the syntax?? ok so be it
3/28/2013 8Let’s Code: Session 3
3/28/2013 9Let’s Code: Session 3
 Example of a class:
 Special notes : self
3/28/2013 10Let’s Code: Session 3
 Example of a class:
 Special notes : self
 Looking a bit deepr: where are these created
 Some other concepts
 Adding attributes
 Deleting instances
 Control the delete operation
3/28/2013 11Let’s Code: Session 3
 Problem:
 Build an employee database
 What attributes do we want to keep?
 What operations do we want?
 What else can we do?
 Extend definitons of Employee
 Multiple Inheritance
3/28/2013 12Let’s Code: Session 3
 Creating a “super Employee”
 Use attributes the same as Employee but add a new
attribute: position
 Way out : Inheritance
3/28/2013 13Let’s Code: Session 3
 Change the bonus function
 Give 100$ more if CEO
 Way out function overloading
3/28/2013 14Let’s Code: Session 3
 Multiple Inheritance
 Another “base class”
 Creating the super Duper employee
3/28/2013 15Let’s Code: Session 3
 Operator overloading
 Iterators
 Generators
3/28/2013 16Let’s Code: Session 3
A Big thanks to the sponsor for this session:
 And best of all!! Akamai is currently recruiting for
summer interns. All positions are listed at
jobs.akamai.com or you can send resumes directly to
gkoenig@akamai.com
3/28/2013 17Let’s Code: Session 3
 Sample Codes:
https://c9.io/pchakraborty/lets-code
 Other refereces:
http://docs.python.org/2/tutorial/classes.html
3/28/2013 18Let’s Code: Session 3

More Related Content

Similar to Lets code classes_python

Mdst 3559-03-03-sql-php-2
Mdst 3559-03-03-sql-php-2Mdst 3559-03-03-sql-php-2
Mdst 3559-03-03-sql-php-2Rafael Alvarado
 
Top 5 things to know about sql azure for developers
Top 5 things to know about sql azure for developersTop 5 things to know about sql azure for developers
Top 5 things to know about sql azure for developersIke Ellis
 
JavaOne 2007 - TS4721
JavaOne 2007 - TS4721 JavaOne 2007 - TS4721
JavaOne 2007 - TS4721 Edgar Silva
 
Microsoft azure data fundamentals (dp 900) practice tests 2022
Microsoft azure data fundamentals (dp 900) practice tests 2022Microsoft azure data fundamentals (dp 900) practice tests 2022
Microsoft azure data fundamentals (dp 900) practice tests 2022SkillCertProExams
 
Cis407 a ilab 6 web application development devry university
Cis407 a ilab 6 web application development devry universityCis407 a ilab 6 web application development devry university
Cis407 a ilab 6 web application development devry universitylhkslkdh89009
 
Python SQLite3...
Python                                                                SQLite3...Python                                                                SQLite3...
Python SQLite3...VikasTuwar1
 
Tech bug webinar Blackboard Learn OpenDB
Tech bug webinar Blackboard Learn OpenDBTech bug webinar Blackboard Learn OpenDB
Tech bug webinar Blackboard Learn OpenDBScott Hurrey
 
Entity Query API
Entity Query APIEntity Query API
Entity Query APImarcingy
 
BigDataCloud meetup - July 8th - Cost effective big-data processing using Ama...
BigDataCloud meetup - July 8th - Cost effective big-data processing using Ama...BigDataCloud meetup - July 8th - Cost effective big-data processing using Ama...
BigDataCloud meetup - July 8th - Cost effective big-data processing using Ama...BigDataCloud
 
Aen007 Kenigsberg 091807
Aen007 Kenigsberg 091807Aen007 Kenigsberg 091807
Aen007 Kenigsberg 091807Dreamforce07
 
bmarshall teaching Calculation Manager on prem
bmarshall teaching Calculation Manager on prembmarshall teaching Calculation Manager on prem
bmarshall teaching Calculation Manager on premRoma766619
 
PATTERNS07 - Data Representation in C#
PATTERNS07 - Data Representation in C#PATTERNS07 - Data Representation in C#
PATTERNS07 - Data Representation in C#Michael Heron
 
DBMS LAB FILE1 task 1 , task 2, task3 and many more.pdf
DBMS LAB FILE1 task 1 , task 2, task3 and many more.pdfDBMS LAB FILE1 task 1 , task 2, task3 and many more.pdf
DBMS LAB FILE1 task 1 , task 2, task3 and many more.pdfAbhishekKumarPandit5
 
Questions On The Code And Core Module
Questions On The Code And Core ModuleQuestions On The Code And Core Module
Questions On The Code And Core ModuleKatie Gulley
 
Sql server 2012 tutorials writing transact-sql statements
Sql server 2012 tutorials   writing transact-sql statementsSql server 2012 tutorials   writing transact-sql statements
Sql server 2012 tutorials writing transact-sql statementsSteve Xu
 
Pattern matching presentation
Pattern matching presentationPattern matching presentation
Pattern matching presentationMichael Dimmitt
 
dude wheres my domain admins v1.pptx
dude wheres my domain admins v1.pptxdude wheres my domain admins v1.pptx
dude wheres my domain admins v1.pptxJoel Leo
 

Similar to Lets code classes_python (20)

Mdst 3559-03-03-sql-php-2
Mdst 3559-03-03-sql-php-2Mdst 3559-03-03-sql-php-2
Mdst 3559-03-03-sql-php-2
 
Top 5 things to know about sql azure for developers
Top 5 things to know about sql azure for developersTop 5 things to know about sql azure for developers
Top 5 things to know about sql azure for developers
 
Machine learning
Machine learning Machine learning
Machine learning
 
JavaOne 2007 - TS4721
JavaOne 2007 - TS4721 JavaOne 2007 - TS4721
JavaOne 2007 - TS4721
 
Microsoft azure data fundamentals (dp 900) practice tests 2022
Microsoft azure data fundamentals (dp 900) practice tests 2022Microsoft azure data fundamentals (dp 900) practice tests 2022
Microsoft azure data fundamentals (dp 900) practice tests 2022
 
Cis407 a ilab 6 web application development devry university
Cis407 a ilab 6 web application development devry universityCis407 a ilab 6 web application development devry university
Cis407 a ilab 6 web application development devry university
 
Python SQLite3...
Python                                                                SQLite3...Python                                                                SQLite3...
Python SQLite3...
 
Tech bug webinar Blackboard Learn OpenDB
Tech bug webinar Blackboard Learn OpenDBTech bug webinar Blackboard Learn OpenDB
Tech bug webinar Blackboard Learn OpenDB
 
Sql Lab 4 Essay
Sql Lab 4 EssaySql Lab 4 Essay
Sql Lab 4 Essay
 
Sql Server 2000
Sql Server 2000Sql Server 2000
Sql Server 2000
 
Entity Query API
Entity Query APIEntity Query API
Entity Query API
 
BigDataCloud meetup - July 8th - Cost effective big-data processing using Ama...
BigDataCloud meetup - July 8th - Cost effective big-data processing using Ama...BigDataCloud meetup - July 8th - Cost effective big-data processing using Ama...
BigDataCloud meetup - July 8th - Cost effective big-data processing using Ama...
 
Aen007 Kenigsberg 091807
Aen007 Kenigsberg 091807Aen007 Kenigsberg 091807
Aen007 Kenigsberg 091807
 
bmarshall teaching Calculation Manager on prem
bmarshall teaching Calculation Manager on prembmarshall teaching Calculation Manager on prem
bmarshall teaching Calculation Manager on prem
 
PATTERNS07 - Data Representation in C#
PATTERNS07 - Data Representation in C#PATTERNS07 - Data Representation in C#
PATTERNS07 - Data Representation in C#
 
DBMS LAB FILE1 task 1 , task 2, task3 and many more.pdf
DBMS LAB FILE1 task 1 , task 2, task3 and many more.pdfDBMS LAB FILE1 task 1 , task 2, task3 and many more.pdf
DBMS LAB FILE1 task 1 , task 2, task3 and many more.pdf
 
Questions On The Code And Core Module
Questions On The Code And Core ModuleQuestions On The Code And Core Module
Questions On The Code And Core Module
 
Sql server 2012 tutorials writing transact-sql statements
Sql server 2012 tutorials   writing transact-sql statementsSql server 2012 tutorials   writing transact-sql statements
Sql server 2012 tutorials writing transact-sql statements
 
Pattern matching presentation
Pattern matching presentationPattern matching presentation
Pattern matching presentation
 
dude wheres my domain admins v1.pptx
dude wheres my domain admins v1.pptxdude wheres my domain admins v1.pptx
dude wheres my domain admins v1.pptx
 

More from Iccha Sethi

Resilient Event Driven Systems With Kafka
Resilient Event Driven Systems With KafkaResilient Event Driven Systems With Kafka
Resilient Event Driven Systems With KafkaIccha Sethi
 
Redis High availability and fault tolerance in a multitenant environment
Redis High availability and fault tolerance in a multitenant environmentRedis High availability and fault tolerance in a multitenant environment
Redis High availability and fault tolerance in a multitenant environmentIccha Sethi
 
So youwanttobeopenstackcontributor
So youwanttobeopenstackcontributorSo youwanttobeopenstackcontributor
So youwanttobeopenstackcontributorIccha Sethi
 
OpenStack Workshop - WECode Harvard Conference
OpenStack Workshop - WECode Harvard ConferenceOpenStack Workshop - WECode Harvard Conference
OpenStack Workshop - WECode Harvard ConferenceIccha Sethi
 
Grace Hopper Conference Opensource Day - OpenStack workshop
Grace Hopper Conference Opensource Day - OpenStack workshopGrace Hopper Conference Opensource Day - OpenStack workshop
Grace Hopper Conference Opensource Day - OpenStack workshopIccha Sethi
 
Clinician Decision Support Dashboard
Clinician Decision Support DashboardClinician Decision Support Dashboard
Clinician Decision Support DashboardIccha Sethi
 

More from Iccha Sethi (8)

Resilient Event Driven Systems With Kafka
Resilient Event Driven Systems With KafkaResilient Event Driven Systems With Kafka
Resilient Event Driven Systems With Kafka
 
Redis High availability and fault tolerance in a multitenant environment
Redis High availability and fault tolerance in a multitenant environmentRedis High availability and fault tolerance in a multitenant environment
Redis High availability and fault tolerance in a multitenant environment
 
So youwanttobeopenstackcontributor
So youwanttobeopenstackcontributorSo youwanttobeopenstackcontributor
So youwanttobeopenstackcontributor
 
OpenStack Workshop - WECode Harvard Conference
OpenStack Workshop - WECode Harvard ConferenceOpenStack Workshop - WECode Harvard Conference
OpenStack Workshop - WECode Harvard Conference
 
Grace Hopper Conference Opensource Day - OpenStack workshop
Grace Hopper Conference Opensource Day - OpenStack workshopGrace Hopper Conference Opensource Day - OpenStack workshop
Grace Hopper Conference Opensource Day - OpenStack workshop
 
Python 101 1
Python 101   1Python 101   1
Python 101 1
 
Osrs
OsrsOsrs
Osrs
 
Clinician Decision Support Dashboard
Clinician Decision Support DashboardClinician Decision Support Dashboard
Clinician Decision Support Dashboard
 

Recently uploaded

Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfSeasiaInfotech2
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 

Recently uploaded (20)

Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdf
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 

Lets code classes_python

  • 1. Presented by: Prithwish Chakraborty LET’S CODE!!! Sponsored by: AKAMAI Reference: http://www.tutorialspoint.com/python/python_classes_objects.htm
  • 2.  Python  Variables:  Basic data structures :  Lists  Dictionaries  Tuples  Basic operators:  Addition/subtraction  Division/Mutliplication  Functions?? 3/28/2013 1Let’s Code: Session 3
  • 4.  Problem:  Build an employee database 3/28/2013 3Let’s Code: Session 3
  • 5.  Problem:  Build an employee database  What attributes do we want to keep?  Employee Name: e.g. Sylvester Stallone  Employee Address: e.g. (Beverly Hills, California, USA)  Employee Id: e.g. 127001  Employee Salary: e.g. $1000000  What operations do we want?  What other things can we do? 3/28/2013 4Let’s Code: Session 3
  • 6.  Problem:  Build an employee database  What attributes do we want to keep?  What operations do we want?  Get Employee Name  Get Employee id  Change Salary  Give 100$ bonus if address is in Beverly Hills  Add a new information about the employee  Add info about speciality e.g. “Mind Blowing Action Movies”  What else can we do? 3/28/2013 5Let’s Code: Session 3
  • 7.  Create an Employee:  Which data structure to use ??  Lets use dict  Attributes: 3/28/2013 6Let’s Code: Session 3 Attribute Type Example name string “Sylvester Stallone” address tuple (“Beverly Hills”,”CA”,”USA”) id int 127001 salary int 1000000
  • 8.  Create an Employee:  Functions:  Now let us extend this to a database >  Non-object oriented way  Object Oriented way 3/28/2013 7Let’s Code: Session 3 Actions Example Logic get_employee_name “Sylvester Stallone” get_employee_id 127001 change_salary if(address[0] == “Beverly Hills”): salary += 100 Add_new_info Add attribute: Speciality
  • 9.  Basic philosophy  A “container” to hold attributes and operations realted to those attributes in one single place!!  Anybody having C background?? – lets start of by thinking of struct: container to hold data  How about if we have some funcitons?  What you ask about the syntax?? ok so be it 3/28/2013 8Let’s Code: Session 3
  • 10. 3/28/2013 9Let’s Code: Session 3  Example of a class:  Special notes : self
  • 11. 3/28/2013 10Let’s Code: Session 3  Example of a class:  Special notes : self  Looking a bit deepr: where are these created
  • 12.  Some other concepts  Adding attributes  Deleting instances  Control the delete operation 3/28/2013 11Let’s Code: Session 3
  • 13.  Problem:  Build an employee database  What attributes do we want to keep?  What operations do we want?  What else can we do?  Extend definitons of Employee  Multiple Inheritance 3/28/2013 12Let’s Code: Session 3
  • 14.  Creating a “super Employee”  Use attributes the same as Employee but add a new attribute: position  Way out : Inheritance 3/28/2013 13Let’s Code: Session 3
  • 15.  Change the bonus function  Give 100$ more if CEO  Way out function overloading 3/28/2013 14Let’s Code: Session 3
  • 16.  Multiple Inheritance  Another “base class”  Creating the super Duper employee 3/28/2013 15Let’s Code: Session 3
  • 17.  Operator overloading  Iterators  Generators 3/28/2013 16Let’s Code: Session 3
  • 18. A Big thanks to the sponsor for this session:  And best of all!! Akamai is currently recruiting for summer interns. All positions are listed at jobs.akamai.com or you can send resumes directly to gkoenig@akamai.com 3/28/2013 17Let’s Code: Session 3
  • 19.  Sample Codes: https://c9.io/pchakraborty/lets-code  Other refereces: http://docs.python.org/2/tutorial/classes.html 3/28/2013 18Let’s Code: Session 3

Editor's Notes

  1. Jump to code: Work through it.
  2. Jump to code: Create Standalone functions
  3. Second bullet: cue – type in a few attribute namesThird bullet: cue – type in a few function names
  4. Cue: go through the concepts:start with class variablefunctionexample of an initializationnotes about init
  5. Cue: go through the concepts:start with class variablefunctionexample of an initializationnotes about init
  6. Cue: go to the demo