4 options
Mastering object-oriented Python : grasp the intricacies of object-oriented programming in Python in order to efficiency build powerful real-world applications / Steven F. Lott ; cover image by Duraid Fatouhi.
- Format:
- Book
- Author/Creator:
- Lott, Steven F., author.
- Series:
- Community experience distilled.
- Community Experience Distilled
- Language:
- English
- Subjects (All):
- Python (Computer program language).
- Physical Description:
- 1 online resource (634 p.)
- Edition:
- 1st edition
- Place of Publication:
- Birmingham, [England] : Packt Publishing, 2014.
- Language Note:
- English
- System Details:
- text file
- Biography/History:
- Lott Steven F. : Steven Lott has been programming since computers were large, expensive, and rare. Working for decades in high tech has given him exposure to a lot of ideas and techniques, some bad, but most are helpful to others. Since the 1990s, Steven has been engaged with Python, crafting an array of indispensable tools and applications. His profound expertise has led him to contribute significantly to Packt Publishing, penning notable titles like "Mastering Object-Oriented, " "The Modern Python Cookbook, " and "Functional Python Programming. " A self-proclaimed technomad, Steven's unconventional lifestyle sees him residing on a boat, often anchored along the vibrant east coast of the US. He tries to live by the words Don't come home until you have a story. F. Lott Steven: Steven Lott has been programming since computers were large, expensive, and rare. Working for decades in high tech has given him exposure to a lot of ideas and techniques, some bad, but most are helpful to others. Since the 1990s, Steven has been engaged with Python, crafting an array of indispensable tools and applications. His profound expertise has led him to contribute significantly to Packt Publishing, penning notable titles like "Mastering Object-Oriented, " "The Modern Python Cookbook, " and "Functional Python Programming. " A self-proclaimed technomad, Steven's unconventional lifestyle sees him residing on a boat, often anchored along the vibrant east coast of the US. He tries to live by the words Don't come home until you have a story.
- Summary:
- This book follows a standard tutorial approach with approximately 750 code samples spread through the 19 chapters. This amounts to over 5,900 lines of code that illustrate each concept.This book is aimed at programmers who have already learned the basics of object-oriented Python and need to write more sophisticated, flexible code that integrates seamlessly with the rest of Python. This book assumes a computer science background, with experience of common Python design patterns.
- Contents:
- Cover; Copyright; Credits; About the Author; About the Reviewers; www.PacktPub.com; Table of Contents; Preface; Some Preliminaries; About casino Blackjack; Playing the game; Blackjack player strategies; Object design for simulating Blackjack; Performance - the time it module; Testing - unittest and doctest; Unit testing and technology spikes; Docstrings - RST markup and documentation tools; The IDE question; About special method names; Summary; Part 1: Pythonic Classes via Special Methods; Chapter 1: The __init__() Method; The implicit superclass - object
- The base class object __init__() method Implementing __init__() in a super class; Using __init__() to create manifest constants; Leveraging __init__() via a factory function; Faulty factory design and the vague else clause; Simplicity and consistency using elif sequences; Simplicity using mapping and class objects; Two parallel mappings; Mapping to a tuple of values; The partial function solution; Fluent APIs for factories; Implementing __init__() in each subclass; Simple composite objects; Wrapping a collection class; Extending a collection class; More requirements and another design
- Complex composite objects Complete composite object initialization; Stateless objects without __init__(); Some additional class definitions; Multi-strategy __init__(); More complex initialization alternatives; Initializing static methods; Yet more __init__() techniques; Initialization with type validation; Initialization, encapsulation, and privacy; Summary; Chapter 2: Integrating Seamlessly with Python - Basic Special Methods; The __repr__() and __str__() methods; Non collection __str__() and __repr__(); Collection __str__() and __repr__(); The __format__() method
- Nested formatting specifications Collections and delegating format specifications; The __hash__() method; Deciding what to hash; Inheriting definitions for immutable objects; Overriding definitions for immutable objects; Overriding definitions for mutable objects; Making a frozen hand from a mutable hand; The __bool__() method; The __bytes__() method; The comparison operator methods; Designing comparisons; Implementation of comparison for objects of the same class; Implementation of comparison for objects of mixed classes; Hard totals, soft totals, and polymorphism
- A mixed class comparison example The __del__() method; The reference count and destruction; Circular references and garbage collection; Circular references and the weak ref module; The __del__() and close() methods; The __new__() method and immutable objects; The __new__() method and metaclasses; Metaclass example 1 - ordered attributes; Metaclass example 2 - self-reference; Summary; Chapter 3: Attribute Access, Properties, and Descriptors; Basic attribute processing; Attributes and the __init__() method; Creating properties; Eagerly computed properties; Setter and deleter properties
- Using special methods for attribute access
- Notes:
- Includes index.
- Description based on online resource; title from PDF title page (ebrary, viewed May 10, 2014).
- ISBN:
- 9781783280988
- 1783280980
- OCLC:
- 878924388
The Penn Libraries is committed to describing library materials using current, accurate, and responsible language. If you discover outdated or inaccurate language, please fill out this feedback form to report it and suggest alternative language.