SlideShare a Scribd company logo
1 of 30
Day 2


Function, Object Oriented, Packaging
Function
Introduction
Function Parameters
Scope of Variables
Global statement
Default Argument Values
Keyword Arguments
The return statement
DocStrings in Functions
                          Day 2
Function : Introduction
Functions are reusable pieces of programs
Functions are defined using the def keyword
A function can take parameters
You can declare variables inside a function
 definition
Functions can have optionals parameters too
Functions can have named arguments


                                              Day 2
Function : Global statement
You can use the values of such variables defined
 outside the function
Try to avoid the use of this global statement




                                                Day 2
Function : Parameters
Parameters are specified within the pair of
 parentheses in the function definition,
 separated by commas.




                                              Day 2
Function : Scope of Variables
the parameter passed in is actually a reference to
  a variable (but the reference is passed by value)
some data types are mutable, but others aren't




                                                 Day 2
Function : Default Argument Values
Used when you want to declare as an optional
 argument
default argument value should be a constant
 (immutable)




                                               Day 2
Function : Keyword Arguments
You can give values for such parameters by
 naming them - this is called keyword arguments
we use the name (keyword) instead of the
 position, to specify the arguments to the
 function.
Benefits of this feature
  no need to remembers the order
  we can give values to only those parameters which
   we want

                                                      Day 2
Function : Keyword Arguments




                               Day 2
Function : Keyword Arguments




                               Day 2
Function : return
The return statement is used to return from a
 function i.e. break out of the function.
We can optionally return a value from the
 function as well.
In python can return one or move values




                                                Day 2
Function : best way to return




                                Day 2
Function : DcdocStrings
documentation strings which is usually referred
 by docstring
important tool, you should make use of it
we can even get back the docstring
from, say a function, when the program is
  actually running!




                                                  Day 2
Function : working with DcdocStrings




                                       Day 2
Object Oriented
Introduction
Classes and Constructors
Object Methods
Class, Object Variables & Properties
Inheritance
Iterators and Generator



                                       Day 2
OO : Introduction
Declare a class with class keyword followed by
 class name


class NewStyle(object):
  """ NewStyle class decleration in Python 3.0 """
   pas s


class OldStyle:
                                                 Day 2
OO : class and constructor
Creating constructors in Python is really easy;
Simple create a method __init__




                                                  Day 2
OO : arguments to constructor
Constructor is an like an methods
We can pass arguments to constructors




                                        Day 2
OO : Object Methods




                      Day 2
OO : Class, Object Variables & Properties
Class variable are static variable
Variable declared with self are Object variable




                                                  Day 2
OO : Class, Object Variables & Properties




                                            Day 2
OO : static method & object method




                                     Day 2
OO : Inheritance




                   Day 2
OO : Magic method




                    Day 2
OO : Iterator and generator
Iterator objects in python conform to the iterator
  protocol
which basically means they provide two methods:
 __iter__() and next()
The __iter__ returns the iterator object and is
 implicitly called at the start of loops.
The next() method returns the next value and is
 implicitly called at each loop increment.
next() raises a StopIteration exception when
                                                  Day 2
OO : Iterator




                Day 2
OO : generator




                 Day 2
Packaging
Modules : Introduction
Byte-compiled .pyc files
A module's __name__
Creating your own Modules
from..import
The dir() function



                            Day 2
Next Session ?
Installation of OpenERP
Working with LP
Understanding structure - Architecture
Customization Without Developments
Exercise: Room Reservation
Module - Minimal Structure
Module structure
Hello World – First module to OpenERP
                                         Day 2
Contact me...

           Mantavya Gajjar

           Phone : 94263 40093

      Email : mail@mantavyagajjar.in

     Website : www.opentechnologies.in

    Follow on Twitter : @mantavyagajjar

                                          Day 2

More Related Content

What's hot

Java Unit 2 (Part 2)
Java Unit 2 (Part 2)Java Unit 2 (Part 2)
Java Unit 2 (Part 2)SURBHI SAROHA
 
Object oriented design
Object oriented designObject oriented design
Object oriented designlykado0dles
 
Brief Summary Of C++
Brief Summary Of C++Brief Summary Of C++
Brief Summary Of C++Haris Lye
 
Programming in Java: Storing Data
Programming in Java: Storing DataProgramming in Java: Storing Data
Programming in Java: Storing DataMartin Chapman
 
Built in classes in java
Built in classes in javaBuilt in classes in java
Built in classes in javaMahmoud Ali
 
Object Oriented Programming Concepts using Java
Object Oriented Programming Concepts using JavaObject Oriented Programming Concepts using Java
Object Oriented Programming Concepts using JavaGlenn Guden
 
Java Programming Paradigms Chapter 1
Java Programming Paradigms Chapter 1 Java Programming Paradigms Chapter 1
Java Programming Paradigms Chapter 1 Sakthi Durai
 
Java căn bản - Chapter2
Java căn bản - Chapter2Java căn bản - Chapter2
Java căn bản - Chapter2Vince Vo
 
Catching co occurrence information using word2vec-inspired matrix factorization
Catching co occurrence information using word2vec-inspired matrix factorizationCatching co occurrence information using word2vec-inspired matrix factorization
Catching co occurrence information using word2vec-inspired matrix factorizationhyunsung lee
 
Neural collaborative filtering-발표
Neural collaborative filtering-발표Neural collaborative filtering-발표
Neural collaborative filtering-발표hyunsung lee
 
CLASSES, STRUCTURE,UNION in C++
CLASSES, STRUCTURE,UNION in C++CLASSES, STRUCTURE,UNION in C++
CLASSES, STRUCTURE,UNION in C++Prof Ansari
 
Md02 - Getting Started part-2
Md02 - Getting Started part-2Md02 - Getting Started part-2
Md02 - Getting Started part-2Rakesh Madugula
 

What's hot (20)

Java Unit 2 (Part 2)
Java Unit 2 (Part 2)Java Unit 2 (Part 2)
Java Unit 2 (Part 2)
 
Object oriented design
Object oriented designObject oriented design
Object oriented design
 
Brief Summary Of C++
Brief Summary Of C++Brief Summary Of C++
Brief Summary Of C++
 
Wrapper classes
Wrapper classesWrapper classes
Wrapper classes
 
JAVA CONCEPTS
JAVA CONCEPTS JAVA CONCEPTS
JAVA CONCEPTS
 
Delphi qa
Delphi qaDelphi qa
Delphi qa
 
Programming in Java: Storing Data
Programming in Java: Storing DataProgramming in Java: Storing Data
Programming in Java: Storing Data
 
Built in classes in java
Built in classes in javaBuilt in classes in java
Built in classes in java
 
Object Oriented Programming Concepts using Java
Object Oriented Programming Concepts using JavaObject Oriented Programming Concepts using Java
Object Oriented Programming Concepts using Java
 
Java Programming Paradigms Chapter 1
Java Programming Paradigms Chapter 1 Java Programming Paradigms Chapter 1
Java Programming Paradigms Chapter 1
 
Java căn bản - Chapter2
Java căn bản - Chapter2Java căn bản - Chapter2
Java căn bản - Chapter2
 
Catching co occurrence information using word2vec-inspired matrix factorization
Catching co occurrence information using word2vec-inspired matrix factorizationCatching co occurrence information using word2vec-inspired matrix factorization
Catching co occurrence information using word2vec-inspired matrix factorization
 
10slide
10slide10slide
10slide
 
Java sessionnotes
Java sessionnotesJava sessionnotes
Java sessionnotes
 
Neural collaborative filtering-발표
Neural collaborative filtering-발표Neural collaborative filtering-발표
Neural collaborative filtering-발표
 
11slide
11slide11slide
11slide
 
CLASSES, STRUCTURE,UNION in C++
CLASSES, STRUCTURE,UNION in C++CLASSES, STRUCTURE,UNION in C++
CLASSES, STRUCTURE,UNION in C++
 
Md02 - Getting Started part-2
Md02 - Getting Started part-2Md02 - Getting Started part-2
Md02 - Getting Started part-2
 
oops-1
oops-1oops-1
oops-1
 
Unit i
Unit iUnit i
Unit i
 

Similar to Python day2

Epic Python Face-Off -Methods vs. Functions.pdf
Epic Python Face-Off -Methods vs. Functions.pdfEpic Python Face-Off -Methods vs. Functions.pdf
Epic Python Face-Off -Methods vs. Functions.pdfSudhanshiBakre1
 
Epic Python Face-Off -Methods vs.pdf
Epic Python Face-Off -Methods vs.pdfEpic Python Face-Off -Methods vs.pdf
Epic Python Face-Off -Methods vs.pdfSudhanshiBakre1
 
Python_Unit_2.pdf
Python_Unit_2.pdfPython_Unit_2.pdf
Python_Unit_2.pdfalaparthi
 
OOPS IN PHP.pptx
OOPS IN PHP.pptxOOPS IN PHP.pptx
OOPS IN PHP.pptxrani marri
 
Object oriented concepts & programming (2620003)
Object oriented concepts & programming (2620003)Object oriented concepts & programming (2620003)
Object oriented concepts & programming (2620003)nirajmandaliya
 
C++ Object oriented concepts & programming
C++ Object oriented concepts & programmingC++ Object oriented concepts & programming
C++ Object oriented concepts & programmingnirajmandaliya
 
+2 CS class and objects
+2 CS class and objects+2 CS class and objects
+2 CS class and objectskhaliledapal
 
Functions2.pdf
Functions2.pdfFunctions2.pdf
Functions2.pdfDaddy84
 
Android Dagger 2
Android  Dagger 2Android  Dagger 2
Android Dagger 2Sanket Shah
 
Java - Basic Concepts
Java - Basic ConceptsJava - Basic Concepts
Java - Basic ConceptsVicter Paul
 
I assignmnt(oops)
I assignmnt(oops)I assignmnt(oops)
I assignmnt(oops)Jay Patel
 
Lecture01 object oriented-programming
Lecture01 object oriented-programmingLecture01 object oriented-programming
Lecture01 object oriented-programmingHariz Mustafa
 
Beginners Guide to Object Orientation in PHP
Beginners Guide to Object Orientation in PHPBeginners Guide to Object Orientation in PHP
Beginners Guide to Object Orientation in PHPRick Ogden
 
python interview prep question , 52 questions
python interview prep question , 52 questionspython interview prep question , 52 questions
python interview prep question , 52 questionsgokul174578
 

Similar to Python day2 (20)

Epic Python Face-Off -Methods vs. Functions.pdf
Epic Python Face-Off -Methods vs. Functions.pdfEpic Python Face-Off -Methods vs. Functions.pdf
Epic Python Face-Off -Methods vs. Functions.pdf
 
Epic Python Face-Off -Methods vs.pdf
Epic Python Face-Off -Methods vs.pdfEpic Python Face-Off -Methods vs.pdf
Epic Python Face-Off -Methods vs.pdf
 
Python_Unit_2.pdf
Python_Unit_2.pdfPython_Unit_2.pdf
Python_Unit_2.pdf
 
functions-.pdf
functions-.pdffunctions-.pdf
functions-.pdf
 
Chapter 05 classes and objects
Chapter 05 classes and objectsChapter 05 classes and objects
Chapter 05 classes and objects
 
OOPS IN PHP.pptx
OOPS IN PHP.pptxOOPS IN PHP.pptx
OOPS IN PHP.pptx
 
Object oriented concepts & programming (2620003)
Object oriented concepts & programming (2620003)Object oriented concepts & programming (2620003)
Object oriented concepts & programming (2620003)
 
Question bank unit i
Question bank unit iQuestion bank unit i
Question bank unit i
 
C++
C++C++
C++
 
C++
C++C++
C++
 
C++ Object oriented concepts & programming
C++ Object oriented concepts & programmingC++ Object oriented concepts & programming
C++ Object oriented concepts & programming
 
+2 CS class and objects
+2 CS class and objects+2 CS class and objects
+2 CS class and objects
 
Functions2.pdf
Functions2.pdfFunctions2.pdf
Functions2.pdf
 
Android Dagger 2
Android  Dagger 2Android  Dagger 2
Android Dagger 2
 
Java - Basic Concepts
Java - Basic ConceptsJava - Basic Concepts
Java - Basic Concepts
 
I assignmnt(oops)
I assignmnt(oops)I assignmnt(oops)
I assignmnt(oops)
 
Patterns in JavaScript
Patterns in JavaScriptPatterns in JavaScript
Patterns in JavaScript
 
Lecture01 object oriented-programming
Lecture01 object oriented-programmingLecture01 object oriented-programming
Lecture01 object oriented-programming
 
Beginners Guide to Object Orientation in PHP
Beginners Guide to Object Orientation in PHPBeginners Guide to Object Orientation in PHP
Beginners Guide to Object Orientation in PHP
 
python interview prep question , 52 questions
python interview prep question , 52 questionspython interview prep question , 52 questions
python interview prep question , 52 questions
 

More from Mantavya Gajjar (16)

Python Day1
Python Day1Python Day1
Python Day1
 
Python Workshop
Python WorkshopPython Workshop
Python Workshop
 
FDP Event Report
FDP Event Report FDP Event Report
FDP Event Report
 
Demonstrate OpenERP
Demonstrate OpenERPDemonstrate OpenERP
Demonstrate OpenERP
 
ERP Implementation cycle
ERP Implementation cycleERP Implementation cycle
ERP Implementation cycle
 
Point of Sale - OpenERP 6.1
Point of Sale - OpenERP 6.1Point of Sale - OpenERP 6.1
Point of Sale - OpenERP 6.1
 
About OpenEPR
About OpenEPRAbout OpenEPR
About OpenEPR
 
Project Management
Project ManagementProject Management
Project Management
 
Order to cash flow
Order to cash flowOrder to cash flow
Order to cash flow
 
Installation
Installation Installation
Installation
 
Education Portal
Education PortalEducation Portal
Education Portal
 
Tiny-Sugar Guide
Tiny-Sugar GuideTiny-Sugar Guide
Tiny-Sugar Guide
 
Subscription
SubscriptionSubscription
Subscription
 
Payroll
PayrollPayroll
Payroll
 
Account voucher
Account voucherAccount voucher
Account voucher
 
Send Mail
Send MailSend Mail
Send Mail
 

Recently uploaded

MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfMr Bounab Samir
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxHumphrey A Beña
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...Nguyen Thanh Tu Collection
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomnelietumpap1
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptxSherlyMaeNeri
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxChelloAnnAsuncion2
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSJoshuaGantuangco2
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfSpandanaRallapalli
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxAshokKarra1
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 

Recently uploaded (20)

MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
 
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptxYOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choom
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptx
 
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptxLEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdf
 
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptxYOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptx
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 

Python day2

  • 1. Day 2 Function, Object Oriented, Packaging
  • 2. Function Introduction Function Parameters Scope of Variables Global statement Default Argument Values Keyword Arguments The return statement DocStrings in Functions Day 2
  • 3. Function : Introduction Functions are reusable pieces of programs Functions are defined using the def keyword A function can take parameters You can declare variables inside a function definition Functions can have optionals parameters too Functions can have named arguments Day 2
  • 4. Function : Global statement You can use the values of such variables defined outside the function Try to avoid the use of this global statement Day 2
  • 5. Function : Parameters Parameters are specified within the pair of parentheses in the function definition, separated by commas. Day 2
  • 6. Function : Scope of Variables the parameter passed in is actually a reference to a variable (but the reference is passed by value) some data types are mutable, but others aren't Day 2
  • 7. Function : Default Argument Values Used when you want to declare as an optional argument default argument value should be a constant (immutable) Day 2
  • 8. Function : Keyword Arguments You can give values for such parameters by naming them - this is called keyword arguments we use the name (keyword) instead of the position, to specify the arguments to the function. Benefits of this feature no need to remembers the order we can give values to only those parameters which we want Day 2
  • 9. Function : Keyword Arguments Day 2
  • 10. Function : Keyword Arguments Day 2
  • 11. Function : return The return statement is used to return from a function i.e. break out of the function. We can optionally return a value from the function as well. In python can return one or move values Day 2
  • 12. Function : best way to return Day 2
  • 13. Function : DcdocStrings documentation strings which is usually referred by docstring important tool, you should make use of it we can even get back the docstring from, say a function, when the program is actually running! Day 2
  • 14. Function : working with DcdocStrings Day 2
  • 15. Object Oriented Introduction Classes and Constructors Object Methods Class, Object Variables & Properties Inheritance Iterators and Generator Day 2
  • 16. OO : Introduction Declare a class with class keyword followed by class name class NewStyle(object): """ NewStyle class decleration in Python 3.0 """ pas s class OldStyle: Day 2
  • 17. OO : class and constructor Creating constructors in Python is really easy; Simple create a method __init__ Day 2
  • 18. OO : arguments to constructor Constructor is an like an methods We can pass arguments to constructors Day 2
  • 19. OO : Object Methods Day 2
  • 20. OO : Class, Object Variables & Properties Class variable are static variable Variable declared with self are Object variable Day 2
  • 21. OO : Class, Object Variables & Properties Day 2
  • 22. OO : static method & object method Day 2
  • 24. OO : Magic method Day 2
  • 25. OO : Iterator and generator Iterator objects in python conform to the iterator protocol which basically means they provide two methods: __iter__() and next() The __iter__ returns the iterator object and is implicitly called at the start of loops. The next() method returns the next value and is implicitly called at each loop increment. next() raises a StopIteration exception when Day 2
  • 26. OO : Iterator Day 2
  • 27. OO : generator Day 2
  • 28. Packaging Modules : Introduction Byte-compiled .pyc files A module's __name__ Creating your own Modules from..import The dir() function Day 2
  • 29. Next Session ? Installation of OpenERP Working with LP Understanding structure - Architecture Customization Without Developments Exercise: Room Reservation Module - Minimal Structure Module structure Hello World – First module to OpenERP Day 2
  • 30. Contact me... Mantavya Gajjar Phone : 94263 40093 Email : mail@mantavyagajjar.in Website : www.opentechnologies.in Follow on Twitter : @mantavyagajjar Day 2