Implementing stateful objects or state machines in Python
Book information
Description
This lesson is a recipe from the Python Cookbook that explores the problem of wanting to implement a state machine or an object that operates in a number of different states, without littering your code with a lot of conditionals. It teaches key solutions such as encoding each operational state as a separate class and arranging for one class to delegate to another class, or directly manipulating certain attributes of instances. What you'll learn—and how you can apply it Learn how to implement a state machine or an object that operates in a number of different states, but doesn’t litter your code with a lot of conditionals. You'll also learn how to encode each operational state as a separate class and arrange for one class to delegate to the other class. Finally, see how to directly manipulate the class attribute of instances. This lesson is for you because… You're an experienced Python programmers who is looking to deepen your understanding of the language and modern programming idioms, such as the advanced techniques used by libraries, frameworks, and applications. Prerequisites Moderate experience as a Python programmer Materials or downloads needed none Read more... Abstract: This lesson is a recipe from the Python Cookbook that explores the problem of wanting to implement a state machine or an object that operates in a number of different states, without littering your code with a lot of conditionals. It teaches key solutions such as encoding each operational state as a separate class and arranging for one class to delegate to another class, or directly manipulating certain attributes of instances. What you'll learn—and how you can apply it Learn how to implement a state machine or an object that operates in a number of different states, but doesn’t litter your code with a lot of conditionals. You'll also learn how to encode each operational state as a separate class and arrange for one class to delegate to the other class. Finally, see how to directly manipulate the class attribute of instances. This lesson is for you because… You're an experienced Python programmers who is looking to deepen your understanding of the language and modern programming idioms, such as the advanced techniques used by libraries, frameworks, and applications. Prerequisites Moderate experience as a Python programmer Materials or downloads needed none
Similar books
Python 3: the ultimate beginners guide for Python 3 programming
2017 · PDF
Python Programming Illustrated For Beginners & Intermediates: Learn By Doing Approach-Step By Step Ultimate Guide To Mastering Python: The Future Is Here!
2018 · EPUB
Python: The Ultimate Beginners Guide: Start Coding Today
2016 · AZW3
An introduction to programming using Python
2016 · PDF
Powerful Python: the most impactful patterns, features and development strategies modern Python provides
2017 · PDF
Python crash course
2019 · PDF
Python Crash Course
EPUB
Introduction to programming using Python: a computational problem-solving focus
2013 · PDF