Python Essential Reference

David M. Beazley

出版时间

2009-07-19

ISBN

9780672329784

评分

★★★★★
书籍介绍
Amazon.com Review Every so often a book comes along that makes you ask yourself, "Gee, when was the last time I had my eyes checked?" David M. Beazley's Python: Essential Reference is just such a book. Condensing thousands of pages of Python online documentation into a compact 319-page softcover, Beazley and his editors used the old-college trick (often performed in reverse) of dickering with the font size to meet a putative page-limit requirement. The result is a truly condensed product fit for the occularly well-adjusted (nota bene). Beazley's subject is Python, a full-featured, freely-redistributable, POSIX-compliant (platforms include Linux, Unix, Macintosh, and Windows) scripting language that is based on object-oriented design principles. As advertised, Beazley's source release (1.5.2) is available from an unfortunately slow server at www.python.org. The installation under Linux (Redhat 5.2) proceeded without incident. Beazley holds true to his catalogic purpose: fully 230 pages are formatted as technical appendices and indices covering the standard litany: built-in function syntax, database features, OS-level interfaces, Internet interfaces, and compiling/profiling/debugging. All references are fully annotated and illustrated with example source code that runs from a couple of lines to a couple of pages. In lock step with competing scripting languages, Python is extensible and embeddable in C and C++, and with blitzkrieg efficiency, Beazley summarizes these crucial practical issues in the final 30 pages. Python users who are tired of chasing questions through hyperlinked online documents will benefit from the expansive random-access index. Python the book captures the orderliness of Python the language. Beazley begins with an 86-page précis of Python in the fashion of Kernighan and Ritchie: too brief for a newbie tutorial but enough to propel old hands into a scripting language that aspires to the elegance of a compiled language. Indeed, it is a byte-compiling language. The line bytecode=compile("some_python_script",'','exec')) creates 'bytecode' as a token executed by exec bytecode. But a five-minute investigation through Beazley's book does not describe how 'bytecode' can be written into a separate executable file. If writing the byte-compiled code to a file is not possible, Python suffers from the limitations of other scripting languages: the executable is the source and cannot be hidden from the user, at least not without some difficulty. Despite its extensibility, embeddability, and pleasing architecture, Python is like other scripting languages: appropriate for solving small nonproprietary problems. Those familiar with more established scriptors like Perl may ask, "Why Python?" Unlike Perl, Python is a product of the fully object-oriented (OO) era, and its constructs reflect design principles that aspire beyond keystroke shortcuts of the succinct-but-often-arcane Perl. Python creator Guido van Rossum cleansed Perl's idiosyncracies and objectified basic data structure, data manipulations, and I/O. With Python, OO is so intrinsic that learning Python is equivalent to learning OO. The same cannot be said of Perl. Unfortunately, comparisons with other languages are missing from Beazley's book. Van Rossum, in an embarrassingly self-serving foreword, preemptively asserts that we readers need "neither evangelizing nor proselytizing"--after all, we already own the book--but we do need galvanizing and we don't find it. Specifically, we need a response to the oft-repeated wisdom that new computer languages are only worth learning if they teach us to organize our thinking along new lines. Scripting languages, however, are for quick and dirty projects: quick to write, easy to hack, and ultimately disposable. The essential tension created by van Rossum and friends is between the elegance of object-oriented principles and the utility of a quick-hacked script. Sadly, the tension remains unresolved in Beazley's reference. There is little to convince us that Python has earned its place in the firmament by changing our thinking. But Beazley has given us much to get us going if we have already taken the leap of faith. --Peter Leopold --This text refers to an out of print or unavailable edition of this title. From Library Journal Though Python is a relatively new programming language, it has quite a significant audience owing to its sensible syntax. An active user of Python since 1996, Beazley provides ample information on the fundamentals of versions 2.0 and 2.1, including syntax, functions, operators, classes, and libraries. This is first and foremost a reference, so he avoids lengthy discussions of Python's superiority. Peppered with good code samples and featuring a companion web site with more extensive pieces, this title should be on hand in larger libraries. Copyright 2001 Reed Business Information, Inc.
AI导读
核心看点
  • 高度浓缩Python语法与标准库,适合作为案头速查手册。
  • 前半部分对语言机制阐述清晰,后半部分库函数覆盖全面。
  • 基于Python 2.6/3.0,内容准确,是进阶开发的权威参考。
适合谁读
  • 具备其他面向对象语言基础,希望快速掌握Python的开发者。
  • 需要查阅Python底层细节、MRO算法及编码差异的进阶者。
  • 寻找从入门到流畅过渡,且能阅读英文技术文档的程序员。
读前提醒
  • 强烈建议阅读英文原版,中文译本质量极差,易导致误解。
  • 前半部分语法讲解精辟,建议精读;后半部分库函数按需查阅。
  • 注意书中部分语法基于旧版本,阅读时需对照当前Python版本。
读者共识
  • 公认的优质Python参考书,被誉为“最好的第二本Python书”。
  • 翻译版本口碑崩盘,错误百出,读者普遍强烈抵制中文译本。
  • 内容虽旧但核心逻辑经典,适合有一定基础者系统梳理知识。

本导读基于书籍简介、目录、原文摘录、短评和书评生成,不等同于全文精读。

精彩摘录
  • "Many people, including the author, even use interactive Python as their desktop calculator."
  • "When you use Python interactively, the special variable _ holds the result of the last operation."
  • "A newline terminates each statement. However, you can use a semicolon to separate statements on the same line."
  • "Although str() and repr() both create strings, their output is usually slightly different. str() produces the output that you get when you use the print statement, whereas repr() creates a string that you type into a program to exactly represent the value of an object."
  • "The format() function is used to convert a value to a string with a specific formatting applied."
  • "The expression [float(line) for line in lines] constructs a new list by looping over all the strings in the list lines and applying the function float() to each element."
  • "a = () b = (item,) c = item,"
  • "name, shares, price = stock"
用户评论
非入门书,对Python这门技术进行非常有条理的阐述;英文看的有些吃力,过段时间再来回顾体会。
是本好书,清明3天要读完
被拯救了
包含语法、系统库、嵌入与扩展的全面内容,与官方文档范围和叙事结构挺像,不错的线下手册。基于Python2.6和3.0,内容准确而丰富,提及了MRO的C3算法、各类Encoding的详细区别等等。
Very clear
前半部分写得很好,后面讲库的跳着翻了点。觉得可以用作入门到流畅之间的过渡。
工具书,随手翻。
小而全 可以多看几遍
都出到第五版了,可见其质量。是很好的reference。
一本书可作两本读,“Probably the best second book on Python”。
收藏