![]()
Table of Contents
Python Unlocked
Credits
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Objects in Depth
Understanding objects
Identity
Value
Type
Making calls to objects
How objects are created
Creation of function objects
Creation of instances
Creation of class objects
Playing with attributes
Descriptors
Class, static, and instance methods
Summary
2. Namespaces and Classes
How referencing objects work – namespaces
Functions with state – closures
Understanding import and modules
Customizing imports
Class inheritance
Method resolution order
Super's superpowers
Using language protocols in classes
Iteration protocol
Context manager protocol
Using abstract classes
Summary
3. Functions and Utilities
Defining functions
Decorating callables
Utilities
Summary
4. Data Structures and Algorithms
Python built-in data structures
Python library data structures
Third party data structures
Arrays/List
Binary tree
Sorted containers
Trie
Algorithms on scale
Summary
5. Elegance with Design Patterns
Observer pattern
Strategy pattern
Singleton pattern
Template pattern
Adaptor pattern
Facade pattern
Flyweight pattern
Command pattern
Abstract factory
Registry pattern
State pattern
Summary
6. Test-Driven Development
Mock for tests
Parameterization
Creating custom test runners
Testing threaded applications
Running test cases in parallel
Summary
7. Optimization Techniques
Writing optimized code
Profiling to find bottlenecks
Using fast libraries
Using C speeds
SWIG
CFFI
Cython
Summary
8. Scaling Python
Going multithreaded
Using multiple processes
Going asynchronous
Scaling horizontally
Summary
Index
![]()
Copyright © 2015 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: December 2015
Production reference: 1181215
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78588-599-0
www.packtpub.com
![]()
Author
Arun Tigeraniya
Reviewers
Mike Driscoll
Chetan Giridhar
Sanjeev Jaiswal
Vishrut Mehta
Commissioning Editor
Veena Pagare
Acquisition Editor
Vivek Anantharaman
Content Development Editors
Neeshma Ramakrishnan
Deepti Thore
Technical Editor
Vijin Boricha
Copy Editor
Priyanka Ravi
Project Coordinator
Shweta H Birwatkar
Proofreader
Safis Editing
Indexer
Mariammal Chettiyar
Production Coordinator
Arvindkumar Gupta
Cover Work
Arvindkumar Gupta
![]()
Arun Tigeraniya has a BE in electronics and communication. After his graduation, he worked at various companies as a Python developer. His main professional interests are AI and Big Data. He enjoys writing efficient and testable code, and interesting technical articles. He has worked with open source technology since 2008. He currently works at Jaarvis Labs Limited, India.
![]()
Mike Driscoll has been programming in Python since 2006. He enjoys writing about Python on his blog at http://www.blog.pythonlibrary.org/. He co-authored Core Python Refcard for DZone. Mike has also been a technical reviewer for Python 3 Object Oriented Programming, Python 2.6 Graphics Cookbook and Tkinter GUI Application Development Hotshot, all by Packt Publishing. He recently wrote the book Python 101, and is working on his next book.
Chetan Giridhar is a Python developer, open source enthusiast, and start-up specialist. He has authored/reviewed books on Python, published papers in journals, and delivered talks in conferences around the world. You can get in touch with him at
<[email protected]>.
He has also reviewed IPython Interactive Computing and Visualization Cookbook by Packt Publishing.
Sanjeev Jaiswal is a computer graduate having 6 years of industrial experience. He uses Perl, Python, and GNU/Linux for his day-to-day work. Sanjeev teaches Perl, Python, web development online as well. Sanjeev has worked closely with major clients, such as CSC, IBM, United Online, and Syniverse. He has also developed an interest in web application security since 2013.
Sanjeev loves teaching technical stuff to engineering students and IT professionals, and he has been teaching since 2008. He founded Alien Coders (http://www.aliencoders.org/) based on the Learning through sharing principle for computer science students and IT professionals in 2010, and it became a huge hit in India amongst engineering students.
He usually uploads technical videos on YouTube under the AlienCoders tag. One can follow him on:
- Facebook at http://www.facebook.com/jassics
- Twitter at http://twitter.com/jassics
He wrote an Instant book called WebSpeed Optimization Techniques, and Learning Django Web Development by Packt Publishing, and he is always looking forward to author or review more and more books from Packt and other publishers.
Vishrut Mehta is a dual degree student of IIIT Hyderabad, currently in his 5th year. He is completing his MS under Dr. Vasudeva Varma, Research Dean of IIIT, at Search and Information Extraction Lab (SIEL). He works in areas related to software-defined networks and cloud computing. He completed his internship at Google last summer and a research internship at INRIA, France, in 2014. During his internship, he worked on various areas of cloud computing, such as automatic reconfiguration of a multicloud application. Vishrut also participated in Google Summer of Code in 2013 and was also was the admin for the Google Code-in between 2013 and 2014 for Sahana Software Foundation.
He has also reviewed Learning Python Network Programming, Untangle Network Security, and Python Network Programming Cookbook, all by Packt Publishing.
![]()
Support files, eBooks, discount offers, and more
For support files and downloads related to your book, please visit www.PacktPub.com.
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook versi...