Você está na página 1de 6

Python Programming

5 day Training Program

Pre-requisites
1. Participants need to be expert level in at least one programming language
2. Participants should be fully conversant with development tools - either command line or
IDE (command line would be used for the training)

Lab requirements
1. 1:1 or 2:1 participant-machine ratio for hands-on and exercises
2. Local installation of Python (ActivePython 3.x+ community edition should work)

Agenda

Day 1

Python Introduction [2 hrs]


 The Python interpreter
 Python Data Types
o int
o str
o list
o tuple
o Dictionaries
 Built in operators, functions and methods
 List comprehension
 Data and type introspection basics
o type()
 dir()
 Control structures
o for
o while
o if-else-elseif
 Functions
o Creating functions
o Arguments
o passing functions around

Exercises [1 hr]
 Hands-on based on all the above topics

Modular Development [1.5 hr]


 Packages
 Namespaces
 Creating modules
 Importing modules into programs
 Importing from sys.path
 Local Imports
 Controlling imports with __all__
 Exercises: Implementing and importing a module

Standard Python modules [1.5 hrs]


 Using the sys module
o sys.path
o sys.argv
 os module
o File system/directory functions
o Basic process management functions
o Recursive dir listing with os.walk
o os.path
 dir name, base name
 joining di-paths platform independently
 time and datetime modules
 Exercises
o Changing programs to take command line input
o File operations using shutil module

Exercise of the day, Q&A [1hr]


 One exercise covering all the above
 Doubt clearing and Q&A

Day 2

Class basics [3 hr]


 init
 self
 private vs public convention
 object creation
 type of objects
 inheritance, multiple inheritance
 Encapsulation
 Polymorphism
 Super

Properties and Class methods [1 hrs]


 Class attributes
 Static methods (w/ inheritance)
 class methods (w/inheritance)
 Properties
 Properties and inheritance

Exercises [1 hr]
 Hands-on based on all the above topics

Iterables [1.5 hrs]


 The map() function
 Multiple input sequence
 map() vs comprehensions
 The filter() functions
 Combining map() and reduce()
 Generators
 Yield
 Use of any() method

Exercises [1 hr]
 Hands-on based on all the above topics

Day 3

Collections [2.5 hr]


 Collection Protocol
 Collection Construction
 Container/Sized/Iterables protocols
 The sequence protocol
o Slicing
o Indexing
o Reversing
o index()
o Concatenation and repetition
o Count()

Exercises [1 hr]
 Hands-on based on all the above topics

More with functions/calling [2.5 hr]


 Use of library fnmatch
 Features of library typing (Type/List)
 Callables
 Classes/objects and callables
 call__ magic method
 Detecting callable objects
 Extended formal argument syntax
 Extended call syntax
 Lambda functions and its usage

Exercises [1 hr]
 Hands-on based on all the above topics
Day 4

Closures [1.5 hrs]


 Local functions
 Returning functions from functions
 Closure and nested scopes
 Function factories
 Non Local Keyword

Context Managers [1.5 hrs]


 File Handling
 The with keyword
 Context manager as an object
 enter and __exit magic fns
 Defining context manager classes
 Instantiating and using context managers
 Common mistakes to avoid

Exercises [1 hr]
 Hands-on based on all the above topics

Unit Testing [2.5 hr]
 PyUnit
 unittest module
 test fixture
 TestCase class
 FunctionTestCase class
 The setUP() and tearDown() methods
 TestSuite class
 test runner and the run() method
 TestResult
 doctest module
o interactive session output discovery

Exercises [1 hr]
 Hands-on based on all the above topics
Day 5

Errors and Exceptions [1.5 hr]


 Introduction
 Exception and control flow
 Stack rewind
 The Standard Exception Hierarchy
 Exception payloads
 Traceback objects
 Assertions

Strings and Regular Expressions [2.5hr]


 Str and string types
 Operators and methods
 ‘re’ module
 Basics of Regular Expressions
 Match objects
 Submatches
 .findall()
 .subs()

Exercises [1 hr]
 Hands-on based on all the above topics

Last 2 hours kept for clearing doubts or revision/practice of any topic

Você também pode gostar