没有合适的资源?快使用搜索试试~ 我知道了~
Fluent Python 原版pdf by Ramalho
5星 · 超过95%的资源 需积分: 50 188 下载量 174 浏览量
2018-05-05
09:44:36
上传
评论 1
收藏 12.19MB PDF 举报
温馨提示
“Python is an easy to learn, powerful programming language.” Those are the first words of the official Python Tutorial. That is true, but there is a catch: because the language is easy to learn and put to use, many practicing Python programmers leverage only a fraction of its powerful features. An experienced programmer may start writing useful Python code in a matter of hours. As the first productive hours become weeks and months, a lot of developers go on writing Python code with a very strong accent carried from languages learned before. Even if Python is your first language, often in academia and in introductory books it is presented while carefully avoiding language-specific features.
资源推荐
资源详情
资源评论
Luciano Ramalho
Fluent
Python
CLEAR, CONCISE, AND EFFECTIVE PROGRAMMING
Luciano Ramalho
Boston
Fluent Python
Fluent Python
by Luciano Ramalho
Copyright © 2015 Luciano Gama de Sousa Ramalho. All rights reserved.
Printed in the United States of America.
Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472.
O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions are
also available for most titles (http://safaribooksonline.com). For more information, contact our corporate/
institutional sales department: 800-998-9938 or corporate@oreilly.com.
Editors: Meghan Blanchette and Rachel Roumeliotis
Production Editor: Melanie Yarbrough
Copyeditor: Kim Cofer
Proofreader: Jasmine Kwityn
Indexer: Judy McConville
Cover Designer: Ellie Volckhausen
Interior Designer: David Futato
Illustrator: Rebecca Demarest
August 2015:
First Edition
Revision History for the First Edition:
2015-07-24: First release
2015-08-21: Second release
See http://oreilly.com/catalog/errata.csp?isbn=9781491946008 for release details.
The O’Reilly logo is a registered trademark of O’Reilly Media, Inc. Fluent Python, the cover image, and
related trade dress are trademarks of O’Reilly Media, Inc.
While the publisher and author have used good faith efforts to ensure that the information and instructions
contained in this work are accurate, the publisher and the author disclaim all responsibility for errors or
omissions, including without limitation responsibility for damages resulting from the use of or reliance on
this work. Use of the information and instructions contained in this work is at your own risk. If any code
samples or other technology this work contains or describes is subject to open source licenses or the intel‐
lectual property rights of others, it is your responsibility to ensure that your use thereof complies with such
licenses and/or rights.
ISBN: 978-1-491-94600-8
[LSI]
Table of Contents
Preface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xv
Part I. Prologue
1.
The Python Data Model. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
A Pythonic Card Deck 4
How Special Methods Are Used 8
Emulating Numeric Types 9
String Representation 11
Arithmetic Operators 12
Boolean Value of a Custom Type 12
Overview of Special Methods 13
Why len Is Not a Method 14
Chapter Summary 14
Further Reading 15
Part II. Data Structures
2.
An Array of Sequences. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Overview of Built-In Sequences 20
List Comprehensions and Generator Expressions 21
List Comprehensions and Readability 21
Listcomps Versus map and filter 23
Cartesian Products 23
Generator Expressions 25
Tuples Are Not Just Immutable Lists 26
Tuples as Records 26
Tuple Unpacking 27
v
Nested Tuple Unpacking 29
Named Tuples 30
Tuples as Immutable Lists 32
Slicing 33
Why Slices and Range Exclude the Last Item 33
Slice Objects 34
Multidimensional Slicing and Ellipsis 35
Assigning to Slices 36
Using + and * with Sequences 36
Building Lists of Lists 37
Augmented Assignment with Sequences 38
A += Assignment Puzzler 40
list.sort and the sorted Built-In Function 42
Managing Ordered Sequences with bisect 44
Searching with bisect 44
Inserting with bisect.insort 47
When a List Is Not the Answer 48
Arrays 48
Memory Views 51
NumPy and SciPy 52
Deques and Other Queues 55
Chapter Summary 57
Further Reading 59
3.
Dictionaries and Sets. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
Generic Mapping Types 64
dict Comprehensions 66
Overview of Common Mapping Methods 66
Handling Missing Keys with setdefault 68
Mappings with Flexible Key Lookup 70
defaultdict: Another Take on Missing Keys 70
The __missing__ Method 72
Variations of dict 75
Subclassing UserDict 76
Immutable Mappings 77
Set Theory 79
set Literals 80
Set Comprehensions 81
Set Operations 82
dict and set Under the Hood 85
A Performance Experiment 85
Hash Tables in Dictionaries 87
vi | Table of Contents
剩余762页未读,继续阅读
资源评论
- alpha_0072019-01-15excellent, thank you.
nn123456789
- 粉丝: 14
- 资源: 128
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功