Python In – Depth: Use Python Programming Features, Techniques, and Modules to Solve Everyday Problems
- Length: 364 pages
- Edition: 1
- Language: English
- Publisher: BPB Publications
- Publication Date: 2020-10-05
- ISBN-10: 938932842X
- ISBN-13: 9789389328424
- Sales Rank: #1446524 (See Top 100 Books)
Build it with Python, the popular and batteries-included programming tool
Key Features
- Get familiar with the fundamentals of Python.
- Understand the OOP paradigm and learn to write your custom object classes.
- Explore tools and techniques to measure code execution for Performance Optimization.
- Understand how Python is used in the main Cryptographic mechanisms.
Description
“Python In-Depth” gives you a detailed presentation of the possibilities for solving everyday problems, even complex ones using Python.
You will begin by setting up Python in your system and then learn about the fundamentals of Python so that you have a rock-solid foundation to build upon. You will explore the foundations of Python programming, such as the built-in data types, functions, objects and classes, files, etc. You will then explore the different programming paradigms such as OOP, Functional, and Concurrent, and find the best approach given a situation. You will also learn how to utilize an interchange format to exchange data and understand how to carry out performance optimization, effective debugging, and security, among other techniques. Towards the end, you will enjoy two chapters dedicated to two domains where Python usage is currently very strong: Data Science and Web Development.
What will you learn
- Learn how to improve your Python Code Quality.
- Explore the techniques and frameworks for Python GUI Programming.
- Solve Data Science and Machine Learning problems using Python.
- Get familiar with Python web frameworks; Django and Flask.
Who this book is for
This book is for anyone who is new to Software Development and wants to learn Python. Existing Python users can also use this book for a quick reference for the fundamentals and the features introduced in Python 3.7.
Cover Page Title Page Copyright Page About the Authors Acknowledgement Preface Errata Table of Contents 1. Getting Started with Python Introduction Structure Objective Installation On Linux, using your package manager On macOS, using Homebrew On Linux, using the pyenv tool On Windows, using the official Windows installer Using the Python interpreter A first look at Python Printing things Variables Code indentation Simple data types Numeric data Strings Booleans More data types Lists Dictionaries Tuples Operations Identity Variable assignment Comparison operations Arithmetic operations Operations on sequences Overview of Python’s new features F-strings Numeric values with an underscore An optional type system Data classes Asyncio Other new features Conclusion Questions 2. Program Flow and Error Handling Introduction Structure Objective Program flow The if…else statements Iterations The while loop The for loop List comprehensions Other control flow statements The break statement The continue statement The pass statement Error handling Python standard exceptions Raising an exception Handling exceptions Conclusion Questions 3. Functions, Modules, and Functional Programming Introduction Structure Objective Functions Returning a value Function parameters and arguments Default values Documenting functions What stops the execution of a function? Variable length arguments list (*args and **kwargs) Built-in functions The int builtin The str builtin The list builtin The enumerate builtin The exit builtin Lambda functions Modules Understand “importing” Built-in modules The os module The sys module Your modules The “import” syntax The “import” mechanism Packages Scripts Functional programming The map function The filter function The functools.reduce function Conclusion Questions 4. Useful Modules and Libraries Introduction Structure Objective Sys Sys variables Dynamic variables Static variables Sys functions Random Class Random Class SystemRandom Integer functions Sequence functions Distribution Random constants Collections Counter Deque Wrapper classes Csv Module functions CSV classes DictReader DictWriter Dialect classes CSV constants Data and object serialization JSON Encoding JSON (serialization) Decoding JSON (de-serialization) Pretty printing Pickle Pickling (serialization) Unpickling (de-serialization) Pickle vs. JSON Recurrent third-party modules Requests Requests API Response objects Performance Schedule Module classes Module functions Conclusion Questions 5. Object Orientation Introduction Structure Objective Classes and objects Introspecting objects with the dir() function Defining your classes Class instantiation Methods Instance methods Class methods Static methods Inheritance and multiple inheritances Single inheritance Multiple inheritance Attribute visibility Getters and Setters Python properties Property getter and setter Property function Using the (new) “data classes” feature Introduction to data classes Inheritance __post_init__() method Useful dataclasses module functions Mutable vs. immutable data classes Abstract base class (ABC): Introduction and a small example Subclassing vs. concrete class registration Abstract methods Concrete methods Python abstract properties Conclusion Questions 6. Decorators and Iterators Introduction Structure Objective Closures Decorators What is a decorator? Syntactic sugar for decorators Passing parameters to decorators Writing decorators using functools.wraps Iterators Helper functions for iterators Iterating in for loops Defining your iterator class Conclusion Questions 7. Files and Data Persistence Introduction Structure Objective Manipulating files The “with” syntax Opening two files Writing a file Appending text to a file Binary files Reading a PDF file Reading an image file Writing an image file File paths and file system operations Accessing a path and its subdirectories and files Creating a directory Reading and writing files Tabular data Relational databases Conclusion Questions 8. Context Managers Introduction Structure Objective The try…finally clause Resource management with try…finally Resource management the Pythonic way Implementation of a context manager using a class Using multiple context managers Implementation of a context manager using a function Conclusion Questions 9. Performance Optimization Introduction Structure Objective Improving speed Measuring code execution time The timeit module Step 1: Profile your code Step 2: Reduce code execution time Improving memory usage Step 1: Profile for memory usage Step 2: Reduce memory usage Conclusion Questions 10. Cryptography Introduction Structure Objective What is cryptography? Cryptography with Python The crypt module The cryptography module The hashlib module The HMAC module Symmetric encryption “secret key” Stream cipher encryption Caesar cipher Block cipher encryption Modes of operation Data Encryption Standard (DES) Symmetric encryption with fernet Asymmetric encryption “public key” Diffie-Hellmann RSA Hashing Collision Resistant Hash Functions (CRHF) Message Digest 5 (MD5) Secure Hash Algorithm (SHA) Message Authentication Code (MAC) Conclusion Questions 11. Concurrent Execution Introduction Structure Objective What is concurrency? Concurrency using threads How threads work Step 1: Creating threads Step 2: Starting threads Step 3: Waiting for threads to finish More examples Concurrency using processes The subprocess module Concurrency using asynchronous IO Conclusion Questions 12. Logging and Debugging Introduction Structure Objective Understanding the debugger Start debugging in Python Debugging complex programs Moving ahead Debugging tools Some very important tips for debugging Understanding the Logger Why are logs useful? Logging in Python Configuring logger Formatting the output Logging variable data Logging stack traces Classes and functions More on Handlers More on Formatters Configuring methods Conclusion Questions 13. Code Style and Quality Assurance Introduction Structure Objective Zen of Python General programming guidelines Naming convention Beautiful is better than ugly Comments Avoid adding whitespace Programming recommendations Ensuring PEP 8 Moving towards Quality Assurance Software Quality Assurance Python and SQA Conclusion Questions 14. Code Packaging and Dependencies Introduction Structure Objective Packaging Python libraries and tools Python modules Python source distributions Python binary distributions Packaging Python applications Depending on a framework Service platforms Web browsers and mobile applications Python modules Depending on pre-installed Python Bringing own Python executable Bringing own user space Bringing own kernel Bringing your hardware Dependency management Managing application dependencies Installing pipenv Installing packages Using installed packages Alternatives Multiple requirements.txt files Pipreqs and pipdeptree Conclusion Questions 15. GUI Programming Introduction Structure Objective Introduction to GUI programming GUI architectural patterns Model-View-Controller Presentation-Abstraction-Control Overview of Python GUI frameworks Kivy PyForms GUI PyQt The Tkinter GUI framework tkinter.Tk tkinter.Widget Geometry managers tkinter.Variable tkinter.Menu tkinter.Button tkinter.Label tkinter.Entry tkinter.Event tkinter.Canvas Example with Tkinter The model View Controller Conclusion Questions 16. Web Development Introduction Structure Objective Overview of Python web frameworks Popular frameworks Other frameworks A webapp with Django Start the application URL routing and views Templates Models A RESTful API with Flask Approach 1: Using Flask directly Approach 2: Using Flask-Restful Conclusion Questions 17. Data Science Introduction Structure Objective What is data? Structured data Unstructured data Semi-structured data Moving towards data science Setting up the environment Python for data science NumPy Pandas Python for reading data Missing values Combining datasets Python for data visualizations Machine learning Subcategories of ML Supervised learning Unsupervised learning Reinforcement learning Scikit Learn Let’s start! Conclusion Questions
Donate to keep this site alive
1. Disable the AdBlock plugin. Otherwise, you may not get any links.
2. Solve the CAPTCHA.
3. Click download link.
4. Lead to download server to download.