Python Unlocked
eBook - ePub

Python Unlocked

  1. 172 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Python Unlocked

About this book

Become more fluent in Python—learn strategies and techniques for smart and high-performance Python programming

About This Book

  • Write smarter, bug-free, high performance code with minimal effort
  • Uncover the best tools and options available to Python developers today
  • Deploy decorators, design patters, and various optimization techniques to use Python 3.5 effectively

Who This Book Is For

If you are a Python developer and you think that you don't know everything about the language yet, then this is the book for you. We will unlock the mysteries and re-introduce you to the hidden features of Python to write efficient programs, making optimal use of the language.

What You Will Learn

  • Manipulate object creation processes for instances, classes, and functions
  • Use the best possible language constructs to write data structures with super speed and maintainability
  • Make efficient use of design patterns to decrease development time and make your code more maintainable
  • Write better test cases with an improved understanding of the testing framework of Python and unittests, and discover how to develop new functionalities in it
  • Write fully-optimized code with the Python language by profiling, compiling C modules, and more
  • Unlock asynchronous programming to build efficient and scalable applications

In Detail

Python is a versatile programming language that can be used for a wide range of technical tasks—computation, statistics, data analysis, game development, and more. Though Python is easy to learn, it's range of features means there are many aspects of it that even experienced Python developers don't know about. Even if you're confident with the basics, its logic and syntax, by digging deeper you can work much more effectively with Python – and get more from the language.

Python Unlocked walks you through the most effective techniques and best practices for high performance Python programming - showing you how to make the most of the Python language. You'll get to know objects and functions inside and out, and will learn how to use them to your advantage in your programming projects. You will also find out how to work with a range of design patterns including abstract factory, singleton, strategy pattern, all of which will help make programming with Python much more efficient. Finally, as the process of writing a program is never complete without testing it, you will learn to test threaded applications and run parallel tests.

If you want the edge when it comes to Python, use this book to unlock the secrets of smarter Python programming.

Style and approach

This is book had been created to help you to "unlock" the best ways to tackle the challenges and performance bottlenecks that many Python developers face today. The keys are supported with program examples to help you understand the concepts better and see them in action.

Tools to learn more effectively

Saving Books

Saving Books

Keyword Search

Keyword Search

Annotating Text

Annotating Text

Listen to it instead

Listen to it instead

Information

Python Unlocked


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

Python Unlocked

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

Credits

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

About the Author

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.

About the Reviewers

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 .
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.

www.PacktPub.com

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...

Table of contents

  1. Python Unlocked

Frequently asked questions

Yes, you can cancel anytime from the Subscription tab in your account settings on the Perlego website. Your subscription will stay active until the end of your current billing period. Learn how to cancel your subscription
No, books cannot be downloaded as external files, such as PDFs, for use outside of Perlego. However, you can download books within the Perlego app for offline reading on mobile or tablet. Learn how to download books offline
Perlego offers two plans: Essential and Complete
  • Essential is ideal for learners and professionals who enjoy exploring a wide range of subjects. Access the Essential Library with 800,000+ trusted titles and best-sellers across business, personal growth, and the humanities. Includes unlimited reading time and Standard Read Aloud voice.
  • Complete: Perfect for advanced learners and researchers needing full, unrestricted access. Unlock 1.4M+ books across hundreds of subjects, including academic and specialized titles. The Complete Plan also includes advanced features like Premium Read Aloud and Research Assistant.
Both plans are available with monthly, semester, or annual billing cycles.
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 990+ topics, we’ve got you covered! Learn about our mission
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more about Read Aloud
Yes! You can use the Perlego app on both iOS and Android devices to read anytime, anywhere — even offline. Perfect for commutes or when you’re on the go.
Please note we cannot support devices running on iOS 13 and Android 7 or earlier. Learn more about using the app
Yes, you can access Python Unlocked by Arun Tigeraniya in PDF and/or ePUB format, as well as other popular books in Computer Science & Programming in Python. We have over one million books available in our catalogue for you to explore.