Advanced Python Best Practices and Design Patterns

Duration: 4 Days

Course Overview

This advanced Python training course will expand your foundational Python programming skills to build reliable and stable applications

On-line from
your chosen location

At our dedicated
training facility

On-site at
your premises

Target Audience

Experienced and intermediate developers, software architects, and data scientists looking to standardize professional coding practices.

COURSE OBJECTIVES

In this course, you will learn how to:

• Employ design patterns and best practices in Python applications
• Exploit the object-oriented programming features in Python for stable, reliable programs
• Create and manage concurrent threads of control
• Generate and consume REST web service requests and responses
• Implement Gang of Four (GoF) design patterns to solve commonly recurring software design problems

Advanced Python Course Benefits

• Unit test, debug, and install Python programmes and modules
• Profile programme execution and improve performance
• Apply advanced Python programming features for efficient, reliable, and maintainable programmes
• Gain knowledge and skills applicable to all Python environments, including Microsoft Windows, macOS, and all Linux and UNIX distributions
• Test your knowledge in the included end-of-course exam
• Continue learning and face new challenges with after-course one-on-one instructor coaching

Course Content

Module 1: Object-Oriented Programming in Python

• Extend classes to define subclasses
• Add properties to a class
• Define abstract base classes

Module 2: Exploring Python Features

• Write “Pythonic” code
• Modify code dynamically with monkey patching
• Process large data structures efficiently with generators
• Handle exceptions
• Raise user-defined exceptions
• Reduce code complexity with context managers and the “with” statement

Module 3: Verifying Code and Unit Testing

• Develop and run Python unit tests
• Simplify automated testing with the Pytest package
• Verify code behavior
• Mock dependent objects with the Mock package
• Use mock objects to verify code behavior when exceptions occur

Module 4: Detecting Errors and Debugging Techniques

• Log messages for auditing and debugging
• Check your code for potential bugs with Pylint
• Debug your Python code
• Extract error information from exceptions
• Trace programme execution with the PyCharm IDE

Module 5: Implementing Python Design Patterns

• Implement the Decorator pattern using @decorator
• Control access to an object with the Proxy pattern
• Lay out a skeleton algorithm in the Template Method pattern
• Enable loose coupling between classes with the Observer pattern

Module 6: Interfacing with REST Web Services and Clients

• Build a REST service
• Generate JSON responses to support Ajax clients
• Send REST requests from a Python client
• Consume JSON and XML response data

Module 7: Measuring and Improving Application Performance

• Time execution of functions with the “timeit” module
• Profile programme execution using “cProfile”
• Manipulate an execution profile interactively with “pstats”
• Efficiently apply data structures, including lists, dictionaries, and tuples
• Map and filter data sets using comprehensions
• Replace the standard Python interpreter with PyPy

Module 8: Installing and Distributing Modules

• Install modules from the PyPi repository using “pip”
• Port code between Python versions
• Package Python modules and applications
• Establish isolated Python environments with “virtualenv”
• Build a distribution package with “setuptools”
• Upload your Python modules to a local repository

Module 9: Concurrent Execution

• Create and manage multiple threads of control with the Thread class
• Synchronise threads using locks
• Launch operating system commands as subprocesses
• Synchronise processes with queues
• Parallelise execution using process pools and Executors

COURSE PREREQUISITES

• Strong foundational knowledge of Python syntax, basic OOP concepts, and experience with version control (Git)

TEST CERTIFICATION

• Test your knowledge in the included end-of-course exam

You will receive a full set of course notes
and all supporting materials for your course.

Hard Copy Delivered to your premises or Downloaded to a chosen device.

Download a
Course Outline PDF

You will receive a full set of course notes and all supporting materials for your course.
Hard Copy Delivered to your premises or Downloaded to a chosen device.

To book this course please call 
+44 (0) 1444 410296 or email Info@kplknowledge.co.uk