ENGLISH

Zero to Py : A Comprehensive Guide to Learning the Python Programming Language

Book information

Publisher
Leanpub
Year
2023
ISBN
1000000155
Language
english
Format
PDF
Filesize
3 MB (2688292 bytes)
Pages
315\315
Time added
2023-02-20 17:02:36

Description

A comprehensive guide to learning the Python programming language, written so to be accessible to readers of all levels, from beginner python developers to those who have some experience with python. Even more advanced users may find some utility from the later chapters. This book aims to be a comprehensive guide to learning the Python Programming Language, covering all the essential concepts and topics that a python developer needs to know. This book has been written so to be accessible to readers of all levels, whether you're just starting your journery into programming, or already have some experience with python. Even more advanced users may find some utility from the later chapters. This book is divided into four parts. In Part I of this book, we start by introducing you to the basics of Python, building a foundation on the fundamentals as we cover topics such as data types, operators, control flow, functions, and classes. In Part II of this book, we build upon the foundation established in Part I and dive deeper into more advanced features of the Python programming language. We explore the more advanced features of Python, discussing topics such as generators, the data object model, metaclasses, etc, with the explicit aim to help you write more efficient and elegant code. And finally, we'll look into Python modules and packaging, so we can see how to take your python code and construct libraries which can be shared with the broader python community. In Part III of this book, we will take a closer look at some of the "batteries included" sections of the Python standard library. These are the modules and packages that are included with every Python installation and provide a wide range of functionality that can be used to solve a variety of problems. We'll explore packages like functools, itertools, dataclasses, etc. And finally in Part VI we'll dig into mechanisms for profiling and debugging python. Furthermore when we identify specific pain points in our implementation, we'll see how to refactor our projects to use performant C code for a boost in execution speed. We'll also look into how to use C debuggers to run the python interpreter, so we can debug our C extensions. Table of Contents Zero to Py: A Comprehensive Guide to Learning the Python Programming Language Introduction Part I: A Whirlwind Tour Chapter 0: System Setup Installing Python Python Versions Windows macOS Linux What's in a PATH? Setting up your dev environment Running Python A program that runs programs One interpreter, many modes Chapter 1. Fundamental data types But first, Variables Primitives and Containers Mutability vs Immutability Introduction to Python's data types Primitive Types Booleans Integers Floats Complex Strings Container Types Tuples and Lists Dictionaries Sets Python Objects References to Objects Chapter 2. Operators Arithmetic Assignment Packing operators Comparison Logical What is Truthy? Short-Circuits Logical Assignments Membership Bitwise Identity Chapter 3. Lexical Structure Line Structure Comments Explicit and Implicit Line Joining Indentation Chapter 4. Control Flow if, elif, and else while break continue for What is an Iterable? for/else and break Exception Handling raise from else and finally match type checking guards Or Patterns as Chapter 5. Functions Function Signatures Explicitly positional/key-value Default Values Mutable Types as Default Values Scope Nested Scopes nonlocal and global Closures Anonymous Functions Decorators Chapter 6. Classes data types as classes. __dunder__ methods The __init__ method Attributes Class Attributes A Functional Approach @staticmethod @classmethod Part II. A Deeper Dive Chapter 7. Expressions, Comprehensions, and Generators Generator Expressions Generator Functions yield from List Comprehensions Dictionary Comprehensions Expressions and the Walrus Operator Chapter 8. Python's Built-in Functions Type Conversions Mathematical Functions all() and any() dir() enumerate() eval() and exec() map() filter() input() and print() open() range() sorted() reversed() zip() Chapter 9. The Python Data Model Object Creation Using __new__ and __init__ Singletons Rich Comparisons Operator Overloading String Representations Emulating Containers Emulating Functions Using Slots Customizing Attribute Access Iterators Lazy Evaluation Context Managers Descriptors Chapter 10. Concepts in Object-Oriented Programming Inheritance Calling the Super Class using super() Multiple Inheritance and Method Resolution Order Encapsulation Polymorphism Chapter 11. Metaclasses Chapter 12. The Data Types, Revisited. Numbers Integers Bits and Bytes Floats Float Methods Hex Values Complex Numbers Strings Split and Join Search and Replace Paddings Formatting Translating Partitioning Prefixes and Suffixes Boolean Checks Case Methods Encodings Bytes Decoding Hex Values Tuples Lists Counting and Indexing Copying Mutations Orderings Dictionaries Iter Methods Getter/Setter Methods Mutations Creating new Dictionaries Sets Mutations Set Theory Boolean Checks Copying Chapter 13. Type Hints Incorporating Type Hints Union types Optional type|None Literal Final TypeAlias NewType TypeVar Protocols Runtime type checking Generics TypedDict Chapter 14. Modules, Packages, and Namespaces Modules Module Attributes if __name__ == "__main__": Packages Imports within packages Installation Part III. The Python Standard Library Chapter 15. Copy Chapter 16. Itertools Chaining Iterables Filtering Iterables Cycling Through Iterables Creating Groups Slicing Iterables Zip Longest Chapter 17. Functools Partials Reduce Pipes Caching Dispatching Chapter 18. Enums, NamedTuples, and Dataclasses Enums NamedTuples Dataclasses Chapter 19. Multithreading and Multiprocessing Multithreading Thread Locks Multiprocessing Process and Pool Process Locks Pipes and Queues concurrent.futures Chapter 20. Asyncio Coroutines Tasks and Task Groups ExceptionGroup and Exception unpacking Part VI. The Underbelly of the Snake Chapter 21. Debugging pdb Other Debuggers Chapter 22. Profiling cProfile flameprof snakeviz memory_profiler Chapter 23. C extensions Hello World hello_world.c setup.py Passing data in and out of Python Memory Management Parsing Arguments Parsing Tuple Arguments Parsing Keyword Arguments Creating PyObjects Importing Modules Defining New Types Stack type Debugging C extensions

Similar books