دسترسی نامحدود
برای کاربرانی که ثبت نام کرده اند
برای ارتباط با ما می توانید از طریق شماره موبایل زیر از طریق تماس و پیامک با ما در ارتباط باشید
در صورت عدم پاسخ گویی از طریق پیامک با پشتیبان در ارتباط باشید
برای کاربرانی که ثبت نام کرده اند
درصورت عدم همخوانی توضیحات با کتاب
از ساعت 7 صبح تا 10 شب
ویرایش:
نویسندگان: Jason C. McDonald
سری:
ISBN (شابک) : 9781718500921, 2022018823
ناشر: No Starch Press
سال نشر: 2022
تعداد صفحات:
زبان: English
فرمت فایل : EPUB (درصورت درخواست کاربر به PDF، EPUB یا AZW3 تبدیل می شود)
حجم فایل: 989 Kb
در صورت تبدیل فایل کتاب Dead Simple Python به فرمت های PDF، EPUB، AZW3، MOBI و یا DJVU می توانید به پشتیبان اطلاع دهید تا فایل مورد نظر را تبدیل نمایند.
توجه داشته باشید کتاب پایتون ساده مرده نسخه زبان اصلی می باشد و کتاب ترجمه شده به فارسی نمی باشد. وبسایت اینترنشنال لایبرری ارائه دهنده کتاب های زبان اصلی می باشد و هیچ گونه کتاب ترجمه شده یا نوشته شده به فارسی را ارائه نمی دهد.
Dead Simple Python مقدمه ای کامل برای تمام ویژگی های زبان پایتون برای برنامه نویسانی است که برای نوشتن کد تولید بی تاب هستند. به جای مرور مجدد مباحث ابتدایی علوم کامپیوتر، شما عمیقاً در الگوهای اصطلاحی پایتون غوطه ور خواهید شد تا بتوانید در کمترین زمان برنامه های حرفه ای پایتون بنویسید. پس از سرعت بخشیدن به نحو اصلی پایتون و راه اندازی یک محیط برنامه نویسی کامل، کار با تایپ داده های پویا پایتون، پشتیبانی آن از تکنیک های برنامه نویسی کاربردی و شی گرا، ویژگی های خاص مانند عبارات مولد و موضوعات پیشرفته مانند همزمانی را یاد خواهید گرفت. همچنین یاد خواهید گرفت که چگونه پروژه پایتون خود را بسته بندی، توزیع، اشکال زدایی و آزمایش کنید. استاد چگونه به • تایپ پویا پایتون را برای تولید کدهای تمیزتر و سازگارتر به کار ببرید. • از تکنیک های تکرار پیشرفته برای ساختار و پردازش داده های خود استفاده کنید. • کلاس ها و عملکردهایی را طراحی کنید که بدون غافلگیری ناخواسته یا محدودیت های دلخواه کار کنند. • از وراثت و درون نگری چندگانه برای نوشتن کلاس هایی که به طور مستقیم کار می کنند استفاده کنید. • پاسخگویی و عملکرد کد خود را با ناهمزمانی، همزمانی و موازی بهبود دهید. •ساختار پروژه پایتون خود را برای آزمایش و توزیع درجه تولید کنید پیتونیک ترین پرایمری که تا کنون چاپ شده است، Dead Simple Python شما را از کار با اصول اولیه به برنامه های برنامه نویسی که ارزش انتشار دارند، می برد.
Dead Simple Python is a thorough introduction to every feature of the Python language for programmers who are impatient to write production code. Instead of revisiting elementary computer science topics, you'll dive deep into idiomatic Python patterns so you can write professional Python programs in no time. After speeding through Python's basic syntax and setting up a complete programming environment, you'll learn to work with Python's dynamic data typing, its support for both functional and object-oriented programming techniques, special features like generator expressions, and advanced topics like concurrency. You'll also learn how to package, distribute, debug, and test your Python project. Master how to •Make Python's dynamic typing work for you to produce cleaner, more adaptive code. •Harness advanced iteration techniques to structure and process your data. •Design classes and functions that work without unwanted surprises or arbitrary constraints. •Use multiple inheritance and introspection to write classes that work intuitively. •Improve your code's responsiveness and performance with asynchrony, concurrency, and parallelism. •Structure your Python project for production-grade testing and distribution The most pedantically pythonic primer ever printed, Dead Simple Python will take you from working with the absolute basics to coding applications worthy of publication.
Title Page Copyright Dedication About the Author Foreword Acknowledgments Introduction Who Is This Book For? What Does “Simple” Mean? What’s in This Book? What’s NOT in This Book How to Read This Book About the Vocabulary Theory Recaps Objective or Opinionated? The Examples What About a Project? Prerequisites Part I: THE PYTHON ENVIRONMENT Chapter 1: The Python Philosophy What Is Python, Exactly? Myths: What Python Isn’t Myth #1: Python Is Merely a Scripting Language Myth #2: Python Is Slow Myth #3: Python Cannot Be Compiled Myth #4: Python Gets Compiled Behind the Scenes Myth #5: Python Is Unsuitable for Large Projects Python 2 vs. Python 3 Defining “Pythonic” Code The Zen of Python Documentation, PEPs, and You Who Calls the Shots? The Python Community The Pursuit of the One Obvious Way Wrapping Up Chapter 2: Your Workbench Installing Python Installing on Windows Installing on macOS Installing on Linux Installing from Source Meet the Interpreter Interactive Session Running Python Files Packages and Virtual Environments Creating a Virtual Environment Activating a Virtual Environment Leaving a Virtual Environment Introducing pip System-Wide Packages Installing Packages requirements.txt Upgrading Packages Removing Packages Finding Packages One Warning About pip . . . Virtual Environments and Git The Whole Shebang File Encoding A Few Extra Virtual Environment Tricks Using a Virtual Environment Without Activating The Alternatives The Line Limit Debate Tabs or Spaces? Quality Control: Static Analyzers Pylint Flake8 Mypy Style Janitors: Autoformatting Tools autopep8 Black Testing Frameworks An Exhibition of Code Editors IDLE Emacs and Vim PyCharm Visual Studio Code Sublime Text Spyder Eclipse + PyDev/LiClipse The Eric Python IDE Wrapping Up Chapter 3: Syntax Crash Course Hello, World! Statements and Expression The Importance of Whitespace Doing Nothing Comments and Docstrings Docstrings Declaring Variables What About Constants? Mathematics Meet the Number Types Operators The math Module Logic Conditionals Comparison Operators Boolean, None, and Identity Operators Truthiness Logical Operators The Walrus Operator Ellipsis Strings String Literals Raw Strings Formatted Strings Template Strings String Conversion A Note on String Concatenation Functions Classes and Objects Error Handling Tuples and Lists Loops while Loop Loop Control for Loop Structural Pattern Matching Literal Patterns and Wildcards Or Patterns Capture Patterns Guard Statements More About Structural Pattern Matching Wrapping Up Chapter 4: Project Structure and Imports Setting Up the Repository Modules and Packages PEP 8 and Naming Project Directory Structure How import Works Import Dos and Don’ts Importing Functions from Modules The Problem of Shadowing The Trouble with Nested Packages Beware of Importing All Importing Within Your Project Absolute Imports Relative Imports Importing from the Same Package Entry Points Module Entry Points Package Entry Points Controlling Package Imports Program Entry Points The Python Module Search Path What Really Happens Wrapping Up Part II: ESSENTIAL STRUCTURES Chapter 5: Variables and Types Variables According to Python: Names and Values Assignment Data Types The type() Function Duck Typing Scope and Garbage Collection Local Scope and the Reference-Counting Garbage Collector Interpreter Shutdown Global Scope The Dangers of Global Scope The nonlocal Keyword Scope Resolution The Curious Case of the Class Generational Garbage Collector The Immutable Truth Passing by Assignment Collections and References Shallow Copy Deep Copy Coercion and Conversion A Note About Systems Hungarian Notation Terminology Review Wrapping Up Chapter 6: Functions and Lambdas Python Function Essentials Recursion Default Argument Values Keyword Arguments On Overloaded Functions Variadic Arguments Keyword Variadic Arguments Keyword-Only Parameters Positional-Only Parameters Argument Types: All Together Now! Nested Functions Closures Recursion with Closures Stateful Closures Lambdas Why Lambdas Are Useful Lambdas as Sorting Keys Decorators Type Hints and Function Annotations Duck Typing and Type Hints Should You Use Type Hinting? Wrapping Up Chapter 7: Objects and Classes Declaring a Class The Initializer The Constructor The Finalizer Attributes Instance Attributes Class Attributes Scope-Naming Conventions Nonpublic Public Name Mangling Public, Nonpublic, or Name Mangled? Methods Instance Methods Class Methods Static Methods Properties Setting Up the Scenario Defining a Property Property with Decorators When Not to Use Properties Special Methods Scenario Setup Conversion Methods Comparison Methods Binary Operator Support Unary Operator Support Making Callable More Special Methods: Looking Ahead Class Decorators Structural Pattern Matching with Objects Functional Meets Object Oriented When to Use Classes Classes Aren’t Modules Single Responsibility Sharing State Are Objects Right for You? Wrapping Up Chapter 8: Errors and Exceptions Exceptions in Python Reading Tracebacks Catching Exceptions: LBYL vs. EAFP Multiple Exceptions Beware the Diaper Anti-pattern Raising Exceptions Using Exceptions Exceptions and Logging Bubbling Up Exception Chaining Else and Finally Else: “If All Goes Well” Finally: “After Everything” Creating Exceptions A Gallery of Exceptions Wrapping Up Part III: DATA AND FLOW Chapter 9: Collections and Iteration Loops while Loops for Loops Collections Tuples Named Tuples Lists Deques Sets frozenset Dictionaries Check or Except? Dictionary Variants Unpacking Collections Starred Expressions Unpacking Dictionaries Structural Pattern Matching on Collections Accessing by Index or Key Slice Notation Start and Stop Negative Indices Steps Copy with Slice Slice Objects Slicing on Custom Objects Using islice The in Operator Checking Collection Length Iteration Iterables and Iterators Manually Using Iterators Iterating with for Loops Sorting Collections in Loops Enumerating Loops Mutation in Loops Loop Nesting and Alternatives Iteration Tools Basic Built-in Tools Filter Map Zip Itertools Custom Iterable Classes Wrapping Up Chapter 10: Generators and Comprehensions Lazy Evaluation and Eager Iterables Infinite Iterators Generators Generators vs. Iterator Classes Closing Generators Behavior on Close Throwing Exceptions yield from Generator Expressions Generator Objects Are Lazy Generator Expressions with Multiple Loops Conditionals in Generator Expressions Nested Generator Expressions List Comprehensions Set Comprehensions Dictionary Comprehensions Hazards of Generator Expressions They Quickly Become Unreadable They Don’t Replace Loops They Can Be Hard to Debug When to Use Generator Expressions Simple Coroutines Returning Values from a Coroutine Sequence of Behavior What About Async? Wrapping Up Chapter 11: Text IO and Context Managers Standard Input and Output Revisiting print() Revisiting input() Streams Context Manager Basics File Modes Reading Files The read() Method The readline() Method The readlines() Method Reading with Iteration Stream Position Writing Files The write() Method The writelines() Method Writing Files with print() Line Separators Context Manager Details How Context Managers Work Using Multiple Context Managers Implementing the Context Management Protocol The __enter__() Method The __exit__() Method Using the Custom Class Paths Path Objects Parts of a Path Creating a Path Relative Paths Paths Relative to Package Path Operations Out-of-Place File Writes The os Module File Formats JSON Other Formats Wrapping Up Chapter 12: Binary and Serialization Binary Notation and Bitwise Number Systems Refresher Python Integers and Binary Bitwise Operations Bytes Literals Bytes-Like Objects Creating a bytes Object Using int.to_bytes() Sequence Operations Converting bytes to int struct struct Format String and Packing Unpacking with struct struct objects Bitwise on Bytes-Like Objects Bitwise Operations via Integers Bitwise Operations via Iteration memoryview Reading and Writing Binary Files Organizing the Data Writing to a File Reading from a Binary File Seek with Binary Stream BufferedRWPair Serialization Techniques Forbidden Tools: pickle, marshal, and shelve Serialization Formats Wrapping Up Part IV: ADVANCED CONCEPTS Chapter 13: Inheritance and Mixins When to Use Inheritance Crimes of Inheritance Basic Inheritance in Python Multiple Inheritance Method Resolution Order Ensuring Consistent Method Resolution Order Explicit Resolution Order Resolving Base Class in Multiple Inheritance Mixins Wrapping Up Chapter 14: Metaclasses and ABCs Metaclasses Creating Classes with type Custom Metaclasses Type Expectations with Duck Typing EAFP: Catching Exceptions LBYL: Checking for Attributes Abstract Classes Built-in ABCs Deriving from ABCs Implementing Custom ABCs Virtual Subclasses Setting Up the Example Using Virtual Subclassing Wrapping Up Chapter 15: Introspection and Generics Special Attributes Inside Object Attribute Access: The __dict__ Special Attribute Listing Attributes Getting an Attribute Checking for an Attribute Setting an Attribute Deleting an Attribute Function Attributes The Wrong Way to Use Function Attributes Mutability and Function Attributes Descriptors The Descriptor Protocol Writing a Descriptor Class (the Slightly Wrong Way) Using a Descriptor Writing a Descriptor Class the Right Way Using Multiple Descriptors in the Same Class Slots Binding Attribute Names to Values Using Arbitrary Attributes with Slots Slots and Inheritance Immutable Classes Single-Dispatch Generic Functions Registering Single-Dispatch Functions with Type Hints Registering Single-Dispatch Functions with Explicit Type Registering Single-Dispatch Functions with the register() Method Using the Element Class Arbitrary Execution Wrapping Up Chapter 16: Asynchrony and Concurrency Asynchrony in Python The Example Scenario: Collatz Game, Synchronous Version Asynchrony Native Coroutines Tasks The Event Loop Making It (Actually) Asynchronous Scheduling and Asynchronous Execution Flow Simplifying the Code Asynchronous Iteration Asynchronous Context Managers Asynchronous Generators Other Asynchrony Concepts Wrapping Up Chapter 17: Threading and Parallelism Threading Concurrency vs. Parallelism Basic Threading Timeouts Daemonic Threads Futures and Executors Timeouts with Futures Race Conditions A Race Condition Example Creating Multiple Threads with ThreadPoolExecutor Locks Deadlock, Livelock, and Starvation Passing Messages with Queue Futures with Multiple Workers Achieving Parallelism with Multiprocessing Pickling Data Speed Considerations and ProcessPoolExecutor The Producer/Consumer Problem Importing the Modules Monitoring the Queue Subprocess Cleanup Consumers Checking for an Empty Queue Producers Starting the Processes Performance Results Logging with Multiprocessing Wrapping Up Part V: BEYOND THE CODE Chapter 18: Packaging and Distribution Planning Your Packaging The Dangers of Cargo Cult Programming A Note on Packaging Opinions Determining Your Packaging Goals Project Structure: src or src-less Packaging a Distribution Package with setuptools Project Files and Structure Where Metadata Belongs The README.md and LICENSE Files The setup.cfg File The setup.py File The MANIFEST.in File The requirements.txt File The pyproject.toml File Testing the Setup Configuration Building Your Package Publishing on pip (Twine) Uploading to Test PyPI Installing Your Uploaded Package Uploading to PyPI Alternative Packaging Tools Poetry Flit Distributing to End Users PEX Freezers Images and Containers A Note on Native Linux Packaging Documentation Wrapping Up Chapter 19: Debugging and Logging Warnings Types of Warnings Filtering Warnings Converting Warnings into Exceptions Logging Logger Objects Handler Objects Logging with Levels Controlling the Log Level Running the Example Filter, Formatter, and Configuration Assert Statements Proper Use of assert Wrong Use of assert Seeing assert in Action The inspect Module Using pdb A Debugging Example Starting the Debugger Debugger Shell Commands Stepping Through the Code Setting a Breakpoint and Stepping into a Function Moving Through the Execution Stack Inspecting the Source Checking a Solution Postmortem Debugging Using faulthandler Evaluating Your Program’s Security with Bandit Reporting Bugs to Python Wrapping Up Chapter 20: Testing and Profiling What About TDD? Test Frameworks The Example Project Testing and Project Structure Testing Basics Starting the Example Unit Testing Executing the Tests with pytest Testing for Exceptions Test Fixtures Continuing the Example: Using the API Sharing Data Between Test Modules Flaky Tests and Conditionally Skipping Tests Advanced Fixtures: Mocking and Parametrizing Continuing the Example: Representing a Typo Parametrizing Indirect Parametrization of Fixtures Mocking Inputs with Monkeypatch Marking Capturing from Standard Streams GUI Testing Continuing the Example: Connecting the API to Typo Autouse Fixtures Mixed Parametrization Fuzzing Wrapping Up the Example Code Coverage Automating Testing with tox Benchmarking and Profiling Benchmarking with timeit Profiling with cProfile or profile tracemalloc Wrapping Up Chapter 21: The Parting of the Ways About the Future Where Do You Go from Here? Application Development in Python Game Development in Python Web Development in Python Client-Side Python Data Science in Python Machine Learning in Python Security Embedded Development in Python Scripting Python Flavors Developing for Python Developing Python Packages and Tools Developing Python Extensions Contributing to Python Getting Involved with Python Asking Questions Answering Questions User Groups PyLadies Conferences Joining the Python Software Foundation And the Road Goes Ever On . . . Appendix A: Special Attributes and Methods Special Methods Special Attributes Appendix B: Python Debugger (pdb) Commands Appendix : Glossary A B C D E F G H I K L M N O P Q R S T U V W Y Z Index