LEADER 05327nam 2200661 450 001 9910790919603321 005 20200520144314.0 010 $a1-78328-098-0 035 $a(CKB)2550000001279495 035 $a(EBL)1674864 035 $a(SSID)ssj0001216570 035 $a(PQKBManifestationID)11788440 035 $a(PQKBTitleCode)TC0001216570 035 $a(PQKBWorkID)11197243 035 $a(PQKB)10892514 035 $a(Au-PeEL)EBL1674864 035 $a(CaPaEBR)ebr10864878 035 $a(CaONFJC)MIL600807 035 $a(OCoLC)878924388 035 $a(CaSebORM)9781783280971 035 $a(MiAaPQ)EBC1674864 035 $a(PPN)228034132 035 $a(EXLCZ)992550000001279495 100 $a20140512h20142014 uy 0 101 0 $aeng 135 $aurunu||||| 181 $ctxt 182 $cc 183 $acr 200 10$aMastering object-oriented Python $egrasp the intricacies of object-oriented programming in Python in order to efficiency build powerful real-world applications /$fSteven F. Lott ; cover image by Duraid Fatouhi 205 $a1st edition 210 1$aBirmingham, [England] :$cPackt Publishing,$d2014. 210 4$dİ2014 215 $a1 online resource (634 p.) 225 1 $aCommunity Experience Distilled 300 $aIncludes index. 311 $a1-78328-097-2 311 $a1-306-69556-2 327 $aCover; 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 327 $aThe 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 327 $aComplex 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 327 $aNested 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 327 $aA 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 327 $aUsing special methods for attribute access 330 $aThis 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. 410 0$aCommunity experience distilled. 606 $aPython (Computer program language) 615 0$aPython (Computer program language) 676 $a005.133 700 $aLott$b Steven F.$01107378 702 $aFatouhi$b Duraid 801 0$bMiAaPQ 801 1$bMiAaPQ 801 2$bMiAaPQ 906 $aBOOK 912 $a9910790919603321 996 $aMastering object-oriented Python$93772886 997 $aUNINA