Day 2Function, Object Oriented, Packaging
FunctionIntroductionFunction ParametersScope of VariablesGlobal statementDefault Argument ValuesKeyword ArgumentsThe retur...
Function : IntroductionFunctions are reusable pieces of programsFunctions are defined using the def keywordA function can ...
Function : Global statementYou can use the values of such variables defined outside the functionTry to avoid the use of th...
Function : ParametersParameters are specified within the pair of parentheses in the function definition, separated by comm...
Function : Scope of Variablesthe parameter passed in is actually a reference to  a variable (but the reference is passed b...
Function : Default Argument ValuesUsed when you want to declare as an optional argumentdefault argument value should be a ...
Function : Keyword ArgumentsYou can give values for such parameters by naming them - this is called keyword argumentswe us...
Function : Keyword Arguments                               Day 2
Function : Keyword Arguments                               Day 2
Function : returnThe return statement is used to return from a function i.e. break out of the function.We can optionally r...
Function : best way to return                                Day 2
Function : DcdocStringsdocumentation strings which is usually referred by docstringimportant tool, you should make use of ...
Function : working with DcdocStrings                                       Day 2
Object OrientedIntroductionClasses and ConstructorsObject MethodsClass, Object Variables & PropertiesInheritanceIterators ...
OO : IntroductionDeclare a class with class keyword followed by class nameclass NewStyle(object):  """ NewStyle class decl...
OO : class and constructorCreating constructors in Python is really easy;Simple create a method __init__                  ...
OO : arguments to constructorConstructor is an like an methodsWe can pass arguments to constructors                       ...
OO : Object Methods                      Day 2
OO : Class, Object Variables & PropertiesClass variable are static variableVariable declared with self are Object variable...
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 generatorIterator objects in python conform to the iterator  protocolwhich basically means they provide ...
OO : Iterator                Day 2
OO : generator                 Day 2
PackagingModules : IntroductionByte-compiled .pyc filesA modules __name__Creating your own Modulesfrom..importThe dir() fu...
Next Session ?Installation of OpenERPWorking with LPUnderstanding structure - ArchitectureCustomization Without Developmen...
Contact me...           Mantavya Gajjar           Phone : 94263 40093      Email : mail@mantavyagajjar.in     Website : ww...
Upcoming SlideShare
Loading in …5
×

Python day2

2,359 views
2,306 views

Published on

Learn Python in 2 days - Day 2

Published in: Education, Technology
1 Comment
0 Likes
Statistics
Notes
  • Be the first to like this

No Downloads
Views
Total views
2,359
On SlideShare
0
From Embeds
0
Number of Embeds
12
Actions
Shares
0
Downloads
57
Comments
1
Likes
0
Embeds 0
No embeds

No notes for slide

Python day2

  1. 1. Day 2Function, Object Oriented, Packaging
  2. 2. FunctionIntroductionFunction ParametersScope of VariablesGlobal statementDefault Argument ValuesKeyword ArgumentsThe return statementDocStrings in Functions Day 2
  3. 3. Function : IntroductionFunctions are reusable pieces of programsFunctions are defined using the def keywordA function can take parametersYou can declare variables inside a function definitionFunctions can have optionals parameters tooFunctions can have named arguments Day 2
  4. 4. Function : Global statementYou can use the values of such variables defined outside the functionTry to avoid the use of this global statement Day 2
  5. 5. Function : ParametersParameters are specified within the pair of parentheses in the function definition, separated by commas. Day 2
  6. 6. Function : Scope of Variablesthe parameter passed in is actually a reference to a variable (but the reference is passed by value)some data types are mutable, but others arent Day 2
  7. 7. Function : Default Argument ValuesUsed when you want to declare as an optional argumentdefault argument value should be a constant (immutable) Day 2
  8. 8. Function : Keyword ArgumentsYou can give values for such parameters by naming them - this is called keyword argumentswe 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. 9. Function : Keyword Arguments Day 2
  10. 10. Function : Keyword Arguments Day 2
  11. 11. Function : returnThe 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. 12. Function : best way to return Day 2
  13. 13. Function : DcdocStringsdocumentation strings which is usually referred by docstringimportant tool, you should make use of itwe can even get back the docstringfrom, say a function, when the program is actually running! Day 2
  14. 14. Function : working with DcdocStrings Day 2
  15. 15. Object OrientedIntroductionClasses and ConstructorsObject MethodsClass, Object Variables & PropertiesInheritanceIterators and Generator Day 2
  16. 16. OO : IntroductionDeclare a class with class keyword followed by class nameclass NewStyle(object): """ NewStyle class decleration in Python 3.0 """ pas sclass OldStyle: Day 2
  17. 17. OO : class and constructorCreating constructors in Python is really easy;Simple create a method __init__ Day 2
  18. 18. OO : arguments to constructorConstructor is an like an methodsWe can pass arguments to constructors Day 2
  19. 19. OO : Object Methods Day 2
  20. 20. OO : Class, Object Variables & PropertiesClass variable are static variableVariable declared with self are Object variable Day 2
  21. 21. OO : Class, Object Variables & Properties Day 2
  22. 22. OO : static method & object method Day 2
  23. 23. OO : Inheritance Day 2
  24. 24. OO : Magic method Day 2
  25. 25. OO : Iterator and generatorIterator objects in python conform to the iterator protocolwhich 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. 26. OO : Iterator Day 2
  27. 27. OO : generator Day 2
  28. 28. PackagingModules : IntroductionByte-compiled .pyc filesA modules __name__Creating your own Modulesfrom..importThe dir() function Day 2
  29. 29. Next Session ?Installation of OpenERPWorking with LPUnderstanding structure - ArchitectureCustomization Without DevelopmentsExercise: Room ReservationModule - Minimal StructureModule structureHello World – First module to OpenERP Day 2
  30. 30. Contact me... Mantavya Gajjar Phone : 94263 40093 Email : mail@mantavyagajjar.in Website : www.opentechnologies.in Follow on Twitter : @mantavyagajjar Day 2

×