Course Summary
Python Fundamentals is a 4-day training course in the Python language and its many applications. The course covers the language itself, explains object-oriented as well as functional programming techniques, error handling, packaging, system and network programming, many of the Python extensions (libraries), as well as best practices. All concepts are explained through hands-on examples and exercises, so students learn by coding in Python.Duration
4 days.
Objectives
Upon completion of this course, you will be able to:
- Develop complex programs in Python
- Understand the best use-case applications for Python
- Use Python's modules for text and XML processing, networking, system process control, database/LDAP/HTTP communication, etc.
- Design your code in both object-oriented and procedural fashion using best practices
- Handle errors in Python
- Write lean Python code
Audience
This course is designed for programmers who need to develop software in Python as well as system administrators who wish to take advantage of Python's simple scripting abilities to automate back-end tasks.
Students should have some prior programming experience and be familiar with basic concepts such as variables/scopes, flow-control, functions, modularization, error handling, TCP/IP networking, and so forth.
Familiarity with object-oriented programming language (such as Java or C++) and/or scripting languages (such as Perl or Bash shell scripting) can be helpful.
Additional Notes
This course can be taught on most major operating systems, which support Python, such as Windows, Linux, Mac OS X, etc.
Outline
Overview
- Background
- Features and Benefits
- Python compared to other languages
- Requirements
- Installation
- Python Shell
Your First Python Program
- HelloWorld
- Keywords
- Identifiers
- Invoking Functions
- Running Python Scripts
Datatypes
- Everything is an object
- Variables
-
- Declaring
- Assigning
- Referencing
- Simple types
- Strings and Unicode Strings
-
- Operations
- Operations
- Lists, Queues, Stacks, Sets
-
- Operations
- range()
- Operations
- Dictionaries
-
- Operations
- Operations
- Tuples
-
- Tuple Operations
Operators and Flow Control
- Operators
- Identation
- if, elif, else
- for, while, else (on loops)
- break, continue, pass
- and, or
- Filtering lists
Functions
- Defining functions
- Default argument values and keyword arguments
- Variable arguments
- Lambda functions
- Introspecting functions with getattr
- Documenting functions
Object Oriented Programming
- Overview of OOP
- Class vs Object
- Defining classes
- Namespaces
- Initialization
- Using self and __init__
- Memory management and garbage collection
- Class vs instance attributes and methods
- Special methods: getitem, setitem, delitem, repr, cmp, len, str
- Comparing objects
- Private method and attribute visibility
Exceptions
- Overview
- Handling Exceptions
- Raising Exceptions
- Defining Custom Exceptions
Modules
- Overview
- Standard modules
- Using modules
- dir function
- Packages
I/O
- File Objects
-
- Reading
- Writing
- Closing
- Handling Exceptions
- The pickle module
- The sys module
- Working with directories
Standard Library
- Command-line arguments
- Streams
- Compression
- Regular Expressions
- Mathematics
- Networking
HTTP Web Client
- Fetching data over HTTP
- Features of HTTP (redirects, user agents, compression, caching)
- Debugging
XML and HTML Processing
- Parsing XML documents
- Unicode
- Accessing elements and attributes
- sgmllib.py
- Extracing data from HTML documents
SOAP Web Services
- Overview
- Installing SOAP libraries
- Accessing web services
-
- Doing Google Search
- Doing Google Search
- Troubleshooting
Unit Testing
- Overview
- Testing for success
- Testing for failure
- Testing for sanity
- Test-driven development
Refactoring
- Handling bugs
- Handling changing requirements
- Refactoring code
Performance Tuning
- Benchmarking
- The timeit module
- Optimizing code
-
- Algorithms
- Regular expressions
- Dictionary lookups
- List operations
- String manipulation
- Algorithms