10.12 Batteries Included

Python has a ``batteries included'' philosophy. This is best seen through the sophisticated and robust capabilities of its larger packages. For example:

Python 包含“batteries included” 哲学。Python可以通过更大的包的来得到应付各种复杂情况的强大能力,从这一点我们可以看出该思想的应用。例如:

* The xmlrpclib and SimpleXMLRPCServer modules make implementing remote procedure calls into an almost trivial task. Despite the names, no direct knowledge or handling of XML is needed.

* xmlrpclibSimpleXMLRPCServer 模块实现了在琐碎的任务中调用远程过程。尽管有这样的名字,其实用户不需要直接处理 XML ,也不需要这方面的知识。

* The email package is a library for managing email messages, including MIME and other RFC 2822-based message documents. Unlike smtplib and poplib which actually send and receive messages, the email package has a complete toolset for building or decoding complex message structures (including attachments) and for implementing internet encoding and header protocols.

* email 包是一个邮件消息管理库,可以处理 MIME 或其它基于 RFC 2822 的消息文档。不同于实际发送和接收消息的 smtplibpoplib 模块,email 包有一个用于构建或解析复杂消息结构(包括附件)以及实现互联网编码和头协议的完整工具集。

* The xml.dom and xml.sax packages provide robust support for parsing this popular data interchange format. Likewise, the csv module supports direct reads and writes in a common database format. Together, these modules and packages greatly simplify data interchange between python applications and other tools.

* xml.domxml.sax 包为流行的信息交换格式提供了强大的支持。同样, csv 模块支持在通用数据库格式中直接读写。综合起来,这些模块和包大大简化了 Python 应用程序和其它工具之间的数据交换。

* Internationalization is supported by a number of modules including gettext, locale, and the codecs package.

* 国际化由 gettextlocalecodecs 包支持。