Effective Python:编写高质量Python代码的59个有效方法(英文版)
前言
致谢
关于作者
Chapter 1: Pythonic Thinking
Item 1: Know Which Version of Python You’re Using
Item 2: Follow the PEP 8 Style Guide
Item 3: Know the Differences Between bytes , str , and unicode
Item 4: Write Helper Functions Inst…
查看完整
致谢
关于作者
Chapter 1: Pythonic Thinking
Item 1: Know Which Version of Python You’re Using
Item 2: Follow the PEP 8 Style Guide
Item 3: Know the Differences Between bytes , str , and unicode
Item 4: Write Helper Functions Inst…
查看完整
Brett Slatkin,是一名谷歌高级软件工程师,他是谷歌消费者调查的工程主管兼联合创始人之一。他曾供职于Google App Engine的Python基础设置部门。他是PubSubHubbub协议的创建者之一。十年前,年纪轻轻的他就已经在用Python来管理谷歌庞大的服务器机群了。
除了日常工作之外,他还研究开源的工具,会在他的个人网站写软件、自行车等方面的文章。他获得了哥伦比亚大学(纽约)计算机工程学士学位。目前住在旧金山。
除了日常工作之外,他还研究开源的工具,会在他的个人网站写软件、自行车等方面的文章。他获得了哥伦比亚大学(纽约)计算机工程学士学位。目前住在旧金山。
《Effective Python:编写高质量Python代码的59个有效方法 英文版》不是要讲述Python的基础编程,而是要帮你掌握Python独特的优势和魅力。《Effective Python:编写高质量Python代码的59个有效方法 英文版》中总结了59个Python编程的优秀实践、贴士和捷径,并用真实代码示例进行了解释。《Effective Python:编写高质量Python代码的59个有效方法 英文版》共分8章,第1章讲述Python的风格思想,介绍了Python中常见问题的推荐解决方案;第2章讲述如何使用Python函数来阐明意图、提升可重用性,并减少错误;第3章介绍如何使用类和继承来表达你对对象的预期行为;第4章介绍了使用这些元类和属性的常用语法;第5章讲述如何在并行和并发的场景下利用好Python;第6章讲述Python中必要的内置模块;第7章教你如何合作开发Python程序;第8章介绍如何使用Python调试、优化和测试程序…
查看完整
查看完整
前言
致谢
关于作者
Chapter 1: Pythonic Thinking
Item 1: Know Which Version of Python You’re Using
Item 2: Follow the PEP 8 Style Guide
Item 3: Know the Differences Between bytes , str , and unicode
Item 4: Write Helper Functions Instead of Complex Expressions
Item 5: Know How to Slice Sequences
Item 6: Avoid Using start , end , and stride in a Single Slice
Item 7: Use List Comprehensions Instead of map and filter
Item 8: Avoid More Than Two Expressions in List Comprehensions
Item 9: Consider Generator Expressions for Large Comprehensions
Item 10: Prefer enumerate Over range
Item 11: Use zip to Process Iterators in Parallel
Item 12: Avoid else Blocks After for and while Loops
Item 13: Take Advantage of Each Block in try / except / else / finally
Chapter 2: Functions
Item 14: Prefer Exceptions to Returning None
Item 15: Know How Closures Interact with Variable Scope
Item 16: Consider Generators Instead of Returning Lists
Item 17: Be Defensive When Iterating Over Arguments
Item 18: Reduce Visual Noise with Variable Positional Arguments
Item 19: Provide Optional Behavior with Keyword Arguments
Item 20: Use None and Docstrings to Specify Dynamic Default Arguments
Item 21: Enforce Clarity with Keyword-Only Arguments
Chapter 3: Classes and Inheritance
Item 22: Prefer Helper Classes Over Bookkeeping with Dictionaries and Tuples
Item 23: Accept Functions for Simple Interfaces Instead of Classes
Item 24: Use @classmethod Polymorphism to Construct Objects Generically
Item 25: Initialize Parent Classes with super
Item 26: Use Multiple Inheritance Only for Mix-in Utility Classes
Item 27: Prefer Public Attributes Over Private Ones
Item 28: Inherit from collections.abc for Custom Container Types
Chapter 4: Metaclasses and Attributes
Item 29: Use Plain Attributes Instead of Get and Set Methods
Item 30: Consider @property Instead of Refactoring Attributes
Item 31: Use Descriptors for Reusable @property Methods
Item 32: Use __getattr__ , __getattribute__ , and __setattr__ for Lazy Attributes
Item 33: Validate Subclasses with Metaclasses
Item 34: Register Class Existence with Metaclasses
Item 35: Annotate Class Attributes with Metaclasses
Chapter 5: Concurrency and Parallelism
Item 36: Use subprocess to Manage Child Processes
Item 37: Use Threads for Blocking I/O, Avoid for Parallelism
Item 38: Use Lock to Prevent Data Races in Threads
Item 39: Use Queue to Coordinate Work Between Threads
Item 40: Consider Coroutines to Run Many Functions Concurrently
Item 41: Consider concurrent.futures for True Parallelism
Chapter 6: Built-in Modules
Item 42: Define Function Decorators with functools.wraps
Item 43: Consider contextlib and with Statements for Reusable try / finally Behavior
Item 44: Make pickle Reliable with copyreg
Item 45: Use datetime Instead of time for Local Clocks
Item 46: Use Built-in Algorithms and Data Structures
Item 47: Use decimal When Precision Is Paramount
Item 48: Know Where to Find Community-Built Modules
Chapter 7: Collaboration
Item 49: Write Docstrings for Every Function, Class, and Module
Item 50: Use Packages to Organize Modules and Provide Stable APIs
Item 51: Define a Root Exception to Insulate Callers from APIs
Item 52: Know How to Break Circular Dependencies
Item 53: Use Virtual Environments for Isolated and Reproducible Dependencies
Chapter 8: Production
Item 54: Consider Module-Scoped Code to Configure Deployment Environments
Item 55: Use repr Strings for Debugging Output
Item 56: Test Everything with unittest
Item 57: Consider Interactive Debugging with pdb
Item 58: Profile Before Optimizing
Item 59: Use tracemalloc to Understand Memory Usage and Leaks
Index
^ 收 起
致谢
关于作者
Chapter 1: Pythonic Thinking
Item 1: Know Which Version of Python You’re Using
Item 2: Follow the PEP 8 Style Guide
Item 3: Know the Differences Between bytes , str , and unicode
Item 4: Write Helper Functions Instead of Complex Expressions
Item 5: Know How to Slice Sequences
Item 6: Avoid Using start , end , and stride in a Single Slice
Item 7: Use List Comprehensions Instead of map and filter
Item 8: Avoid More Than Two Expressions in List Comprehensions
Item 9: Consider Generator Expressions for Large Comprehensions
Item 10: Prefer enumerate Over range
Item 11: Use zip to Process Iterators in Parallel
Item 12: Avoid else Blocks After for and while Loops
Item 13: Take Advantage of Each Block in try / except / else / finally
Chapter 2: Functions
Item 14: Prefer Exceptions to Returning None
Item 15: Know How Closures Interact with Variable Scope
Item 16: Consider Generators Instead of Returning Lists
Item 17: Be Defensive When Iterating Over Arguments
Item 18: Reduce Visual Noise with Variable Positional Arguments
Item 19: Provide Optional Behavior with Keyword Arguments
Item 20: Use None and Docstrings to Specify Dynamic Default Arguments
Item 21: Enforce Clarity with Keyword-Only Arguments
Chapter 3: Classes and Inheritance
Item 22: Prefer Helper Classes Over Bookkeeping with Dictionaries and Tuples
Item 23: Accept Functions for Simple Interfaces Instead of Classes
Item 24: Use @classmethod Polymorphism to Construct Objects Generically
Item 25: Initialize Parent Classes with super
Item 26: Use Multiple Inheritance Only for Mix-in Utility Classes
Item 27: Prefer Public Attributes Over Private Ones
Item 28: Inherit from collections.abc for Custom Container Types
Chapter 4: Metaclasses and Attributes
Item 29: Use Plain Attributes Instead of Get and Set Methods
Item 30: Consider @property Instead of Refactoring Attributes
Item 31: Use Descriptors for Reusable @property Methods
Item 32: Use __getattr__ , __getattribute__ , and __setattr__ for Lazy Attributes
Item 33: Validate Subclasses with Metaclasses
Item 34: Register Class Existence with Metaclasses
Item 35: Annotate Class Attributes with Metaclasses
Chapter 5: Concurrency and Parallelism
Item 36: Use subprocess to Manage Child Processes
Item 37: Use Threads for Blocking I/O, Avoid for Parallelism
Item 38: Use Lock to Prevent Data Races in Threads
Item 39: Use Queue to Coordinate Work Between Threads
Item 40: Consider Coroutines to Run Many Functions Concurrently
Item 41: Consider concurrent.futures for True Parallelism
Chapter 6: Built-in Modules
Item 42: Define Function Decorators with functools.wraps
Item 43: Consider contextlib and with Statements for Reusable try / finally Behavior
Item 44: Make pickle Reliable with copyreg
Item 45: Use datetime Instead of time for Local Clocks
Item 46: Use Built-in Algorithms and Data Structures
Item 47: Use decimal When Precision Is Paramount
Item 48: Know Where to Find Community-Built Modules
Chapter 7: Collaboration
Item 49: Write Docstrings for Every Function, Class, and Module
Item 50: Use Packages to Organize Modules and Provide Stable APIs
Item 51: Define a Root Exception to Insulate Callers from APIs
Item 52: Know How to Break Circular Dependencies
Item 53: Use Virtual Environments for Isolated and Reproducible Dependencies
Chapter 8: Production
Item 54: Consider Module-Scoped Code to Configure Deployment Environments
Item 55: Use repr Strings for Debugging Output
Item 56: Test Everything with unittest
Item 57: Consider Interactive Debugging with pdb
Item 58: Profile Before Optimizing
Item 59: Use tracemalloc to Understand Memory Usage and Leaks
Index
^ 收 起
Brett Slatkin,是一名谷歌高级软件工程师,他是谷歌消费者调查的工程主管兼联合创始人之一。他曾供职于Google App Engine的Python基础设置部门。他是PubSubHubbub协议的创建者之一。十年前,年纪轻轻的他就已经在用Python来管理谷歌庞大的服务器机群了。
除了日常工作之外,他还研究开源的工具,会在他的个人网站写软件、自行车等方面的文章。他获得了哥伦比亚大学(纽约)计算机工程学士学位。目前住在旧金山。
除了日常工作之外,他还研究开源的工具,会在他的个人网站写软件、自行车等方面的文章。他获得了哥伦比亚大学(纽约)计算机工程学士学位。目前住在旧金山。
《Effective Python:编写高质量Python代码的59个有效方法 英文版》不是要讲述Python的基础编程,而是要帮你掌握Python独特的优势和魅力。《Effective Python:编写高质量Python代码的59个有效方法 英文版》中总结了59个Python编程的优秀实践、贴士和捷径,并用真实代码示例进行了解释。《Effective Python:编写高质量Python代码的59个有效方法 英文版》共分8章,第1章讲述Python的风格思想,介绍了Python中常见问题的推荐解决方案;第2章讲述如何使用Python函数来阐明意图、提升可重用性,并减少错误;第3章介绍如何使用类和继承来表达你对对象的预期行为;第4章介绍了使用这些元类和属性的常用语法;第5章讲述如何在并行和并发的场景下利用好Python;第6章讲述Python中必要的内置模块;第7章教你如何合作开发Python程序;第8章介绍如何使用Python调试、优化和测试程序。
^ 收 起
^ 收 起
比价列表
1人想要
公众号、微信群
缺书网
微信公众号
微信公众号
扫码进群
实时获取购书优惠
实时获取购书优惠