Python 3 Object-oriented Programming - Second Edition

Rethink Python programming with this guide to Python data structures, design patterns and effective object oriented techniques, to uncover a truly modern Python

Python 3 Object-oriented Programming - Second Edition

This ebook is included in a Mapt subscription
Dusty Phillips

5 customer reviews
Rethink Python programming with this guide to Python data structures, design patterns and effective object oriented techniques, to uncover a truly modern Python
$10.00
$49.99
RRP $39.99
RRP $49.99
eBook
Print + eBook
Access every Packt eBook & Video for just $100
 
  • 4,000+ eBooks & Videos
  • 40+ New titles a month
  • 1 Free eBook/Video to keep every month
Find Out More
 
Preview in Mapt

Book Details

ISBN 139781784398781
Paperback460 pages

Book Description

Python 3 is more versatile and easier to use than ever. It runs on all major platforms in a huge array of use cases. Coding in Python minimizes development time and increases productivity in comparison to other languages. Clean, maintainable code is easy to both read and write using Python's clear, concise syntax.

Object-oriented programming is a popular design paradigm in which data and behaviors are encapsulated in such a way that they can be manipulated together. Many modern programming languages utilize the powerful concepts behind object-oriented programming and Python is no exception.

Starting with a detailed analysis of object-oriented analysis and design, you will use the Python programming language to clearly grasp key concepts from the object-oriented paradigm. This book fully explains classes, data encapsulation, inheritance, polymorphism, abstraction, and exceptions with an emphasis on when you can use each principle to develop well-designed software.

You'll get an in-depth analysis of many common object-oriented design patterns that are more suitable to Python's unique style. This book will not just teach Python syntax, but will also build your confidence in how to program.

You will also learn how to create maintainable applications by studying higher level design patterns. Following this, you'll learn the complexities of string and file manipulation, and how Python distinguishes between binary and textual data. Not one, but two very powerful automated testing systems will be introduced in the book. After you discover the joy of unit testing and just how easy it can be, you'll study higher level libraries such as database connectors and GUI toolkits and learn how they uniquely apply object-oriented principles. You'll learn how these principles will allow you to make greater use of key members of the Python eco-system such as Django and Kivy.

This new edition includes all the topics that made Python 3 Object-oriented Programming an instant Packt classic. It’s also packed with updated content to reflect recent changes in the core Python library and covers modern third-party packages that were not available on the Python 3 platform when the book was first published.

 

Table of Contents

Chapter 1: Object-oriented Design
Introducing object-oriented
Objects and classes
Specifying attributes and behaviors
Hiding details and creating the public interface
Composition
Inheritance
Case study
Exercises
Summary
Chapter 2: Objects in Python
Creating Python classes
Modules and packages
Organizing module contents
Who can access my data?
Third-party libraries
Case study
Exercises
Summary
Chapter 3: When Objects Are Alike
Basic inheritance
Multiple inheritance
Polymorphism
Abstract base classes
Case study
Exercises
Summary
Chapter 4: Expecting the Unexpected
Raising exceptions
Case study
Exercises
Summary
Chapter 5: When to Use Object-oriented Programming
Treat objects as objects
Adding behavior to class data with properties
Manager objects
Case study
Exercises
Summary
Chapter 6: Python Data Structures
Empty objects
Tuples and named tuples
Dictionaries
Lists
Sets
Extending built-ins
Queues
Case study
Exercises
Summary
Chapter 7: Python Object-oriented Shortcuts
Python built-in functions
An alternative to method overloading
Functions are objects too
Case study
Exercises
Summary
Chapter 8: Strings and Serialization
Strings
Regular expressions
Serializing objects
Case study
Exercises
Summary
Chapter 9: The Iterator Pattern
Design patterns in brief
Iterators
Comprehensions
Generators
Coroutines
Case study
Exercises
Summary
Chapter 10: Python Design Patterns I
The decorator pattern
The observer pattern
The strategy pattern
The state pattern
The singleton pattern
The template pattern
Exercises
Summary
Chapter 11: Python Design Patterns II
The adapter pattern
The facade pattern
The flyweight pattern
The command pattern
The abstract factory pattern
The composite pattern
Exercises
Summary
Chapter 12: Testing Object-oriented Programs
Why test?
Unit testing
Testing with py.test
Imitating expensive objects
How much testing is enough?
Case study
Exercises
Summary
Chapter 13: Concurrency
Threads
Multiprocessing
Futures
AsyncIO
Case study
Exercises
Summary

What You Will Learn

  • Implement objects in Python by creating classes and defining methods
  • Separate related objects into a taxonomy of classes and describe the properties and behaviors of those objects via the class interface
  • Extend class functionality using inheritance
  • Understand when to use object-oriented features, and more importantly when not to use them
  • Discover what design patterns are and why they are different in Python
  • Uncover the simplicity of unit testing and why it's so important in Python
  • Grasp common concurrency techniques and pitfalls in Python 3
  • Exploit object-oriented programming in key Python technologies such as Kivy and Django.
  • Object-oriented programming concurrently with asyncio

Authors

Table of Contents

Chapter 1: Object-oriented Design
Introducing object-oriented
Objects and classes
Specifying attributes and behaviors
Hiding details and creating the public interface
Composition
Inheritance
Case study
Exercises
Summary
Chapter 2: Objects in Python
Creating Python classes
Modules and packages
Organizing module contents
Who can access my data?
Third-party libraries
Case study
Exercises
Summary
Chapter 3: When Objects Are Alike
Basic inheritance
Multiple inheritance
Polymorphism
Abstract base classes
Case study
Exercises
Summary
Chapter 4: Expecting the Unexpected
Raising exceptions
Case study
Exercises
Summary
Chapter 5: When to Use Object-oriented Programming
Treat objects as objects
Adding behavior to class data with properties
Manager objects
Case study
Exercises
Summary
Chapter 6: Python Data Structures
Empty objects
Tuples and named tuples
Dictionaries
Lists
Sets
Extending built-ins
Queues
Case study
Exercises
Summary
Chapter 7: Python Object-oriented Shortcuts
Python built-in functions
An alternative to method overloading
Functions are objects too
Case study
Exercises
Summary
Chapter 8: Strings and Serialization
Strings
Regular expressions
Serializing objects
Case study
Exercises
Summary
Chapter 9: The Iterator Pattern
Design patterns in brief
Iterators
Comprehensions
Generators
Coroutines
Case study
Exercises
Summary
Chapter 10: Python Design Patterns I
The decorator pattern
The observer pattern
The strategy pattern
The state pattern
The singleton pattern
The template pattern
Exercises
Summary
Chapter 11: Python Design Patterns II
The adapter pattern
The facade pattern
The flyweight pattern
The command pattern
The abstract factory pattern
The composite pattern
Exercises
Summary
Chapter 12: Testing Object-oriented Programs
Why test?
Unit testing
Testing with py.test
Imitating expensive objects
How much testing is enough?
Case study
Exercises
Summary
Chapter 13: Concurrency
Threads
Multiprocessing
Futures
AsyncIO
Case study
Exercises
Summary

Book Details

ISBN 139781784398781
Paperback460 pages
Read More
From 5 reviews

Read More Reviews