O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Python Unlocked

Book Description

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.

Table of Contents

  1. Python Unlocked
    1. Table of Contents
    2. Python Unlocked
    3. Credits
    4. About the Author
    5. About the Reviewers
    6. www.PacktPub.com
      1. Support files, eBooks, discount offers, and more
        1. Why subscribe?
        2. Free access for Packt account holders
    7. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
        1. Downloading the example code
        2. Errata
        3. Piracy
        4. Questions
    8. 1. Objects in Depth
      1. Understanding objects
        1. Identity
        2. Value
        3. Type
      2. Making calls to objects
      3. How objects are created
        1. Creation of function objects
        2. Creation of instances
        3. Creation of class objects
      4. Playing with attributes
        1. Descriptors
        2. Class, static, and instance methods
      5. Summary
    9. 2. Namespaces and Classes
      1. How referencing objects work – namespaces
      2. Functions with state – closures
      3. Understanding import and modules
        1. Customizing imports
      4. Class inheritance
        1. Method resolution order
        2. Super's superpowers
      5. Using language protocols in classes
        1. Iteration protocol
        2. Context manager protocol
      6. Using abstract classes
      7. Summary
    10. 3. Functions and Utilities
      1. Defining functions
      2. Decorating callables
      3. Utilities
      4. Summary
    11. 4. Data Structures and Algorithms
      1. Python built-in data structures
      2. Python library data structures
      3. Third party data structures
        1. Arrays/List
        2. Binary tree
        3. Sorted containers
        4. Trie
      4. Algorithms on scale
      5. Summary
    12. 5. Elegance with Design Patterns
      1. Observer pattern
      2. Strategy pattern
      3. Singleton pattern
      4. Template pattern
      5. Adaptor pattern
      6. Facade pattern
      7. Flyweight pattern
      8. Command pattern
      9. Abstract factory
      10. Registry pattern
      11. State pattern
      12. Summary
    13. 6. Test-Driven Development
      1. Mock for tests
      2. Parameterization
      3. Creating custom test runners
      4. Testing threaded applications
      5. Running test cases in parallel
      6. Summary
    14. 7. Optimization Techniques
      1. Writing optimized code
      2. Profiling to find bottlenecks
      3. Using fast libraries
      4. Using C speeds
        1. SWIG
        2. CFFI
        3. Cython
      5. Summary
    15. 8. Scaling Python
      1. Going multithreaded
      2. Using multiple processes
      3. Going asynchronous
      4. Scaling horizontally
      5. Summary
    16. Index