失效链接处理 |
Python编程之美:最佳实践指南 PDF 下载
下载地址:
版权归出版社和原作者所有,链接已删除,请购买正版
用户下载说明:
电子版仅供预览,下载后24小时内务必删除,支持正版,喜欢的请购买正版书籍:
http://product.dangdang.com/11477187823.html
相关截图: 资料简介: 本书是Python用户的一本百科式学习指南,由Python社区数百名成员协作奉献。全书内容分为部分。靠前部分是关于如何配置使用Python编辑工具的;第二部分深入学习地道Python风格的代码范例;第三部分研究Python社区常用的一些代码库。本书适合有Python基础的人员学习,帮助你迅速从小工修炼成专家,编写出高质量的代码! 资料目录: 前言 ........................................................................................... x 部分??起步 章??选择一个解释器 ........................................................................ 3 Python 2 与Python 3 的状况对比 ..........................................................................3 建议 .......................................................................................................................3 那就选择Python 3 吗 .............................................................................................4 Python 的不同实现 ................................................................................................4 CPython ...........................................................................................................5 Stackless ..........................................................................................................5 PyPy ................................................................................................................5 Jython ..............................................................................................................5 IronPython .......................................................................................................6 PythonNet ........................................................................................................6 Skulpt ..............................................................................................................6 MicroPython ....................................................................................................7 第2 章??恰当地安装Python ................................................................... 9 在Mac OS X 上安装Python ..................................................................................9 Setuptools 和pip ........................................................................................... 11 virtualenv ...................................................................................................... 11 在Linux 上安装Python .......................................................................................12 Setuptools 和pip ...........................................................................................12 开发工具 .......................................................................................................13 virtualenv ......................................................................................................14 在Windows 上安装Python ..................................................................................15 Setuptools 和pip ...........................................................................................17 virtualenv ......................................................................................................17 商业化Python 二次发行版 ..................................................................................18 第3 章??搭建开发环境 ......................................................................... 21 文本编辑器 ..........................................................................................................21 Sublime Text ..................................................................................................22 Vim ................................................................................................................23 Emacs ............................................................................................................25 TextMate........................................................................................................26 Atom .............................................................................................................26 Code ..............................................................................................................26 IDE.......................................................................................................................27 PyCharm/IntelliJ IDEA ..................................................................................28 Aptana Studio 3/Eclipse LiClipse PyDev .....................................................29 WingIDE........................................................................................................29 Spyder ...........................................................................................................30 NINJA-IDE ....................................................................................................30 Komodo IDE..................................................................................................30 Eric(Eric Python IDE) .................................................................................31 Visual Studio .................................................................................................31 增强型交互式工具 ...............................................................................................32 IDLE .............................................................................................................32 IPython ..........................................................................................................32 bpython ..........................................................................................................33 环境隔离工具 ......................................................................................................33 虚拟环境 .......................................................................................................33 pyenv .............................................................................................................35 Autoenv .........................................................................................................36 virtualenvwrapper ..........................................................................................36 Buildout .........................................................................................................37 Conda ............................................................................................................38 Docker ...........................................................................................................39 第2 部分??步入正题 第4 章??编写高质量的代码 ................................................................... 43 代码风格 ..............................................................................................................43 PEP 8 .............................................................................................................43 PEP 20(又名Python 之禅) ..........................................................................44 一般性建议 ...................................................................................................45 约定 ...............................................................................................................52 习语 ...............................................................................................................55 常见陷阱 .......................................................................................................58 组织好项目的结构 ...............................................................................................61 模块 ...............................................................................................................61 包 ..................................................................................................................65 面向对象编程 ................................................................................................66 装饰器 ...........................................................................................................67 动态类型 .......................................................................................................68 可变类型和不可变类型 .................................................................................69 管理依赖 .......................................................................................................71 测试代码 ..............................................................................................................72 测试的基础知识 ............................................................................................73 举例说明 .......................................................................................................76 其他流行工具 ................................................................................................80 文档 .....................................................................................................................82 项目文档 .......................................................................................................82 项目配套发行文档 ........................................................................................83 文档字符串与块注释 .....................................................................................84 日志 .....................................................................................................................84 在库中使用logging .......................................................................................85 在应用中使用logging ...................................................................................86 选择许可证 ..........................................................................................................88 上游许可证 ...................................................................................................88 许可证选项 ...................................................................................................89 软件许可相关的学习资源 .............................................................................90 第5 章??阅读高质量的代码 ................................................................... 91 共同特征 ..............................................................................................................92 HowDoI ................................................................................................................92 阅读单文件脚本 ............................................................................................93 取自HowDoI 的结构示例 .............................................................................96 取自HowDoI 的风格示例 .............................................................................97 Diamond ...............................................................................................................99 阅读一个更大的应用程序 .............................................................................99 取自Diamond 的结构示例 .......................................................................... 105 取自Diamond 的风格示例 .......................................................................... 109 Tablib ................................................................................................................. 111 阅读一个小型库 .......................................................................................... 112 取自Tablib 的结构示例 .............................................................................. 115 取自Tablib 的风格示例 .............................................................................. 123 Requests ............................................................................................................. 126 阅读一个更大的库 ...................................................................................... 126 取自Requests 的结构示例 .......................................................................... 130 取自Requests 的风格示例 .......................................................................... 134 Werkzeug ........................................................................................................... 139 阅读一个工具包的代码 ............................................................................... 140 取自Werkzeug 的风格示例 ......................................................................... 148 取自Werkzeug 的结构示例 ......................................................................... 149 Flask................................................................................................................... 156 阅读一个框架的代码 ................................................................................... 156 取自Flask 的风格示例 ................................................................................ 163 取自Flask 的结构示例 ................................................................................ 164 第6 章??交付高质量的代码 ................................................................. 169 有用的词汇和概念 ............................................................................................. 170 打包你的代码 .................................................................................................... 171 Conda .......................................................................................................... 171 PyPI ............................................................................................................. 171 冻结你的代码 .................................................................................................... 174 PyInstaller ................................................................................................... 176 cx_Freeze .................................................................................................... 178 py2app ......................................................................................................... 179 py2exe ......................................................................................................... 180 bbFreeze ...................................................................................................... 181 Linux 已构建分发包的打包技术 ........................................................................ 181 可执行的ZIP 文件 ............................................................................................. 183 第3 部分??场景化指南 第7 章??用户交互 .............................................................................. 187 Jupyter Notebooks 项目 ...................................................................................... 187 命令行应用 ........................................................................................................ 188 图形化用户界面应用 ......................................................................................... 196 窗口部件库 ................................................................................................. 196 游戏开发 ..................................................................................................... 202 Web 应用 ............................................................................................................ 203 Web 框架/ 微框架 ....................................................................................... 203 Web 模板引擎 ............................................................................................. 206 Web 部署 ..................................................................................................... 212 第8 章??代码管理和改进 .................................................................... 215 持续集成 ............................................................................................................ 215 系统管理 ............................................................................................................ 216 服务器自动化 .............................................................................................. 218 系统和任务监控 .......................................................................................... 222 加速 ................................................................................................................... 225 与C/C /FORTRAN 库进行交互 ............................................................... 235 第9 章??软件接口 .............................................................................. 239 Web 客户端库 .................................................................................................... 240 Web API ...................................................................................................... 240 数据序列化 ........................................................................................................ 245 分布式系统 ........................................................................................................ 248 网络编程 ..................................................................................................... 248 密码技术 ............................................................................................................ 254 0 章??数据操作 ............................................................................ 261 科学应用 ............................................................................................................ 262 文本操作和文本挖掘 ......................................................................................... 266 Python 标准库中的字符串工具 ................................................................... 266 图像操作 ..................................................................................................... 269 1 章??数据持久化 ......................................................................... 273 结构化文件 ........................................................................................................ 273 数据库接口库 .................................................................................................... 274 附录A??补充说明 ............................................................................... 289 |