In the Preface, I mentioned that Python emphasizes concepts such as quality, productivity, portability, and integration. Since these four terms summarize most of the reasons for using Python, I'd like to define them in a bit more detail.
我在序言里提到,python强调诸如 质量,生产力,移植和综合等概念。既然这四个术语概括了实用python的原因,我很乐意把它们定义的更详细一些。
Software quality
软件质量
- Python makes it easy to write software that can be understood, reused, and modified. It was deliberately designed to raise development quality expectations in the scripting world. Python's clear syntax and coherent design, for example, almost force programmers to write readable codea critical feature for software that may be changed or reused by others in the future.
- 使用Python编写可理解的可重用和 易于改进的软件比较容易。在脚本的世界里,从Python的出生那天就被期着承担提高开发质量的责任。Python清晰的语法和连贯的设计,比如强制程序员书写可读的代码,这些代码将来可能被其他人更改及重用。
- Of equal importance, because the Python language tries to do better, so too do Python developers and the Python community at large. In the Python world, one finds a refreshing focus on quality concepts such as simplicity, explicitness, and readabilityideas often given little more than a passing glance in some camps. (For more on this Python-inspired mindset, see the sidebar "The Python 'Secret Handshake'," near the end of this chapter.)
- 同样重要的是,正如在Python社区和Python的程序员尝试去做的那样,Python试着做的更好。在Python的世界里,我们可以发现有耳目一新注重质量观念,例如简洁性,明确性,和可读性,这些 往往让一些阵营的人们得到比短暂的一瞥更多东西(如需了解更多关于本巨蟒启发思维,见侧栏这一章接近尾声的小节中的“Python '神秘的握手'”)。
- The Python language really does look like it was designed and not accumulated. It has an orthogonal, explicit, and minimalist design that makes code easy to understand and easy to predict. Python approaches complexity by providing a simple core language and splitting application-specific tools into a large set of modular library components. Python语言看起来确实是设计出来的而不是积累出来的。它有一个正交的,明确的,最低限度的设计,使代码容易理解和容易预测。Python通过提供一个简单的核心语言和拆分特定应用工具为一大套模块库组件来达到复杂性的目的。
- As a popular slogan attests, the result is that Python "fits your brain"it's possible to use the language without constantly flipping through reference manuals. This design makes Python ideal as a customization language for nonexperts. Perhaps most important is that by limiting the number of possible interactions in your code, Python reduces both program complexity and the potential for bugs.
- 作为一个流行的口号证明,其结果是Python"符合你的脑袋" ,使用Python使不必不断翻阅的参考手册成为可能。这种设计使得Python作为一个个性化的语言 ,成为非专家人们的理想工具 。也许最重要的是,通过限制一些可能的相互作用,在你的代码中,Python降低了程序的复杂性和潜力臭虫。
- Besides being well designed, Python is also well tooled for modern software methodologies such as structured, modular, and object-oriented design, which allow code to be written once and reused many times. In fact, due to the inherent power and flexibility of the language, writing high-quality Python components that may be applied in multiple contexts is almost automatic.
- 除了是精心设计的,Python也使用了现代软件方法,如结构化,模块化,面向对象设计,使代码写一次,可重复使用多次。事实上,由于继承性和语言的灵活性,编写高品质Python组件,几乎可自动的应用于多种背景中。
Developer productivity
开发人员的效率
- Python is optimized for speed of development. It's easy to write programs fast in Pthon, because the interpreter handles details you must code explicitly in more complex, lower-level languages. Things such as type declarations, storage layout, memory management, common task implementations, and build procedures are nowhere to be found in Python scripts.
- 对于开发速度,Python是最优化的。用Python写程序快,因为解释器会处理细节,这些细节包括像那些在复杂的低级语言里的清晰编码。像类型声明,存储布局,内存管理,共同的任务实现,并建立程序等无法在Python脚本中找到。