Mastering Objectoriented Python
2104年新出的Python新书,如果你希望掌握Python面向对象编程,那么这本新书应该是不错 的选择。Mastering object-oriented PythonCopyright o 2014 Packt PublishingAll rights reserved. No part of this book may be reproduced, stored in a retrievalsystem, or transmitted in any form or by any means, without the prior writtenpermission of the publisher, except in the case of brief quotations embedded incritical articles or reviewsrt has been made in the preparation of this book to ensure the accuracyof the information presented However the information contained in this book issold without warranty, cither express or implied. Neither the author nor PaclPublishing and its dealers and distributors will be held liable for any damagescaused or alleged to be caused directly or indirectly by this bookPackt Publishing has endeavored to provide trademark information about all of thecompanies and products mentioned in this book by the appropriate use of capitalsHowever, Packt Publishing cannot guarantee the accuracy of this informationFirst published: April 2014Production reference: 1150414Published by Packt Publishing ltdLivery place35 Livery streetBirmingham b3 2PB UKISBN978-1-78328-097-1www.packtpub.comCover Image by duraid Fatouhi (duraidfatouhioyahoo comCreditsAuthorCopy editSteven f lottsiya MorbiwalaKirti PaiReviewersStuti SrivastavaMike driscollRoman JoostProject CoordinatorSakis KasampalisAkash PoojaryAlbert lukaszewski, ph DHugo SoliProofreadersStephen CopestakeCommissioning editorClyde JenkinsUsha lyerLinda morrisJonathan ToddAcquisition EditorGregory WildIndexerMariammal ChettiyarContent Development EditorShaon basuGhicsAbhinash SahuTechnical editorsKapil HernaniProduction coordinatorMonica johnAlwin RoyAkashdeep KunduCover workAlwin royAbout the authorSteven F. Lott has been programming since the 70s, when computers were large,expensive, and rare. As a contract software developer and architect, he has workedon hundreds of projects from very small to very large. He's been using Python tosolve business problems for over 10 yearsSteven is currently a technomad who lives in various places on the east coast of theUs.Histechnologyblogis:http://slott-softwarearchitect.blogspot.comI owe deep gratitude to Floating Leaf for all her supportand guidanceAbout the reviewersMike driscoll has been programming in Python since 2006. He enjoys writingaboutPythononhisblogathttp://www.blog.pythonlibrary.org/.hehasCo-authored Core Python refcard for dzone. Mike has also been a technical reviewerfor various books of Packt Publishing, such as Python 3 Object Oriented Programming,Python 2.6 Graphics Cookbook, and Ikinter Gul Application Development hotshot. Mikerecently wrote the book Python 101I would like to thank my beautiful wife, Evangeline, for alwayssupporting me. I would also like to thank my friends and family forall that they do to help me. I would also like to thank Jesus Christ forSaving me.Roman joost first learned about open source software in 1997. He is the projectmanager of gimps user documentation. He has contributed to gimp and python/Zope open source projects for eight years. Roman works for Red hat inBrisbane, australiaSakis Kasampalis is based in the Netherlands, where he currently works as aSoftware Engineer for a location-based B2B provider. He is not dogmatic aboutparticular programming languages and tools; his principle is that the right toolshould be used for the right job. One of his favorite tools is Python because he findsit very productiveAmong the FOSS activities of Kasampalis is maintaining a Git Hub repository that isrelatedtoimplementingdesignpatternsinPython,whichareavailableathttps://github. com/faif/python-patterns. He was also a technical reviewer of the bookearninig Python Design Patterns, Packt PublishingAlbert Lukaszewski, Ph. D, is principal consultant for Lukaszewski ConsultingServices in southeast Scotland. Having programmed computers for over 30 years,he consults on the system design and implementation. Previously, he served asChief engineer for ACCESS Europe gmbh. Much of his experience is related to textprocessing database systems, and Natural Language Processing(NLP). In additionto MySQL for Python, Packt Publishing he previously wrote a column on Python fortheNewYorkTimessubsidiary,about.comHugo Solis is an assistant professor in the Physics department at the University ofCosta rica. His current research interests are computational cosmology, complexity,and the influence of hydrogen on material properties. He has wide experiencewith languages including C/C++ and Python for scientific programming andvisualization he is a member of the free software foundation and has contributedcode to some free software projects. Currently, he is in charge of the IFT, a CostaRican scientific, non-profit organization for the multidisciplinary practice of physics(http://iftucr.orgI'd like to thank Katty Sanchez, my beloved mother for her supportand vanguard thoughtsWww.Packtpub.comSupport files, eBooks, discount offers and moreYoumightwanttovisitwww.PacktPub.comforsupportfilesanddownloadsrelatedto your bookDid you know that Packt offers e Book versions of every book published, with PDFandepuBfilesavailableYoucanupgradetotheebookversionatwww.packtpubcom and as a print book customer, you are entitled to a discount on the e book copy.Get in touch with us at service@packtpub com for more detailsAtwww.packtpub.comyoucanalsoreadacollectionoffreetechnicalarticlessignup for a range of free newsletters and receive exclusive discounts and offers on Packtbooks and ebooksP PACKTLiBhttp://packtliB.paCktpub.comDo you need instant solutions to your If questions? PacktLib is Packt's online digitalbook library. Here, you can access, read and search across Packt's entire library ofWhy Subscribe?Fully searchable across every book published by packtCopy and paste, print and bookmark contentOn demand and accessible via web browserFree Access for packt account holdersIfyouhaveanaccountwithPacktatwww.packtpub.comyoucanusethistoaccessPacktLib today and view nine entirely free books. Simply use your login credentialsfor immediate accessTable of contentsPrefaceSome preliminariesAbout casino blackjack10Playing the game10Blackjack player strategiesObject design for simulating Blackjack12Performance- the timeit moduleTesting-unittest and doctest13Unit testing and technology spikes15Docstrings-RST markup and documentation tools16The IdE questionAbout special method names18SummaryPart 1: Pythonic Classes via Special MethodsChapter 1: The init O Method25The implicit superclass -object25The base class object init O method26Implementing init o in a superclass27Using init 0 to create manifest constants28Leveraging init o via a factory function30Faulty factory design and the vague else clause31Simplicity and consistency using elif sequences32Simplicity using mapping and class objects33Two parallel mappings34Mapping to a tuple of values34The partial function solution34Fluent apis for factories35
用户评论