【读英文文档】Whetting Your Appetite(刺激你的食欲)
如果你有很多工作是通过计算机来完成的,那么你一定希望其中的很多事情能够自动地实现。比方说,你希望在文本文件中实现查找和替换的功能,以某一种机制实现照片的重命名以及重新排序的功能,一个小型的数据库甚至是一个自己的游戏。
如果你是一个专业的软件开发者,你要使用诸如C/C++/Java这样的开发语言却发现他们的开发周期太长了(编程/编译/测试/重新编译)。也许你正在为编写这样的一个库或者是一组测试用例而苦恼。或者你曾经已经写过一些能够被其它语言扩展的代码,而你又不希望设计一个全新的语言来实现你的目的。
Python就是那个你苦苦期盼的语言。
你可能会写一些Unix脚本代码或者是Windows的批处理文件,但是脚本语言的优点仅仅在于它能够轻易地移动文件和变化的数据,但却嫩一编写出GUI或者游戏。也许你能够写C/C++/Java程序,但是它们往往会花费你大量的时间在开放上。Python更容易使用,具备很好的兼容性,同时也能够使你的工作尽快地完成。
Python允许你将程序分成可以被复用的模块。它包含了很多的标准模块并且能够作为你程序开发的基本单元,或者作为你学习这门语言的例子。这些模块包含了文件IO,系统调用,端口甚至用户图形界面接口TK。
Python是一种直译式的语言,它能够帮你省去大量的编译与链接的时间。解释器能够被交互式地使用,它使得开发者能够轻松地对语言的特性进行测试,写一些一次性的项目,它也使得调试的过程变得非常轻松。它同时也是一个非常方便的计算器。
Python使得语言简洁而具有很强的可读性。用Python写的程序往往比C,C++,Java写的程序要简短。有以下几个原因:
内置数据类型使得复杂的计算能够通过一个简单的表达式实现
语句通过缩进进行识别从而避免了使用括号的麻烦
不需要变量类型的声明
Python具有很强的可扩展性。如果你会用C编写代码,那么你将很轻松地将代码或模块内嵌至Python程序中,或者对关键部分执行最高效的操作。
这种语言的命名Python是来源于一个BBC的电影” Monty Python’s Flying Circus”而与蟒蛇没有丝毫的联系。将该电影中的一些名字写进程序中不仅仅是可行的,还应该是被鼓励的!
既然你现在对Python这种语言如此兴奋,你一定会希望了解更多的细节。因为学习一种语言的最佳方式就是去运用它,那么这个知道将带您一起走进Python的世界。
在下一章中,我们将介绍解释器的机制。它是很乏味的一种知识,但是却对你将来运行Python程序起到至关重要的作用。
该指导的其余部分将通过例子介绍Python的语言特性。顺序是:
simple expressions, statements and data types
→
functions and modules
→
advanced concepts
[Original]
If you do much work on computers, eventually you find that there’s some task you’d like to automate. For example, you may wish to perform a search-and-replace over a large number of text files, or rename and rearrange a bunch of photo files in a complicated way. Perhaps you’d like to write a small custom database, or a specialized GUI application, or a simple game.
If you’re a professional software developer, you may have to work with several C/C++/Java libraries but find the usual write/compile/test/re-compile cycle is too slow. Perhaps you’re writing a test suite for such a library and find writing the testing code a tedious task. Or maybe you’ve written a program that could use an extension language, and you don’t want to design and implement a whole new language for your application.
Python is just the language for you.
You could write a Unix shell script or Windows batch files for some of these tasks, but shell scripts are best at moving around files and changing text data, not well-suited for GUI applications or games. You could write a C/C++/Java program, but it can take a lot of development time to get even a first-draft program. Python is simpler to use, available on Windows, Mac OS X, and Unix operating systems, and will help you get the job done more quickly.
Python is simple to use, but it is a real programming language, offering much more structure and support for large programs than shell scripts or batch files can offer. On the other hand, Python also offers much more error checking than C, and, being a very-high-level language, it has high-level data types built in, such as flexible arrays and dictionaries. Because of its more general data types Python is applicable to a much larger problem domain than Awk or even Perl, yet many things are at least as easy in Python as in those languages.
Python allows you to split your program into modules that can be reused in other Python programs. It comes with a large collection of standard modules that you can use as the basis of your programs — or as examples to start learning to program in Python. Some of these modules provide things like file I/O, system calls, sockets, and even interfaces to graphical user interface toolkits like Tk.
Python is an interpreted language, which can save you considerable time during program development because no compilation and linking is necessary. The interpreter can be used interactively, which makes it easy to experiment with features of the language, to write throw-away programs, or to test functions during bottom-up program development. It is also a handy desk calculator.
Python enables programs to be written compactly and readably. Programs written in Python are typically much shorter than equivalent C, C++, or Java programs, for several reasons:
· the high-level data types allow you to express complex operations in a single statement;
· statement grouping is done by indentation instead of beginning and ending brackets;
· no variable or argument declarations are necessary.
Python is extensible: if you know how to program in C it is easy to add a new built-in function or module to the interpreter, either to perform critical operations at maximum speed, or to link Python programs to libraries that may only be available in binary form (such as a vendor-specific graphics library). Once you are really hooked, you can link the Python interpreter into an application written in C and use it as an extension or command language for that application.
By the way, the language is named after the BBC show “Monty Python’s Flying Circus” and has nothing to do with reptiles. Making references to Monty Python skits in documentation is not only allowed, it is encouraged!
Now that you are all excited about Python, you’ll want to examine it in some more detail. Since the best way to learn a language is to use it, the tutorial invites you to play with the Python interpreter as you read.
In the next chapter, the mechanics of using the interpreter are explained. This is rather mundane information, but essential for trying out the examples shown later.
The rest of the tutorial introduces various features of the Python language and system through examples, beginning with simple expressions, statements and data types, through functions and modules, and finally touching upon advanced concepts like exceptions and user-defined classes.
【读英文文档】Whetting Your Appetite(刺激你的食欲)的更多相关文章
- 教你阅读MSDN英文文档,迅速提升编程能力
在教大家阅读英文文档之前,首先给大家明确一个概念.C#和.NET的区别? 有一定编程经验的同学应该多多少少知道这方面的概念,但是可能模糊,理解的不一定深刻.我在这里简单给出两者的基本定义: C#:仅仅 ...
- openstack【Kilo】汇总:包括20英文文档、各个组件新增功能及Kilo版部署
OpenStack Kilo版本发布 20英文文档OpenStack Kilo版本文档汇总:各个操作系统安装部署.配置文档.用户指南等文档 Kilo版部署 openstack[Kilo]入门 [准备篇 ...
- py爬取英文文档学习单词
最近开始看一些整本整本的英文典籍,虽然能看个大概,但是作为四级都没过的我来说还是有些吃力,总还有一部分很关键的单词影响我对句子的理解,因为看的是纸质的,所以查询也很不方便,于是想来个突击,我想把程序单 ...
- 英文文档帮查&翻译计划
以CSDN为首,知乎其次,cnblog带路的一大批博客上充斥着大量低质量的编程入门教程,代码粗制滥造,毫无缩进,没有高亮,东抄西抄.初学者如果长期参照这种垃圾博客来解决问题,将会适得其反,走入歧途. ...
- Python3求英文文档中每个单词出现的次数并排序
[本文出自天外归云的博客园] 题目要求: 1.统计英文文档中每个单词出现的次数. 2.统计结果先按次数降序排序,再按单词首字母降序排序. 3.需要考虑大文件的读取. 我的解法如下: import ch ...
- gitlab安装教程、gitlab官网、英文文档
gitlab官网 https://about.gitlab.com/ gitlab安装和官网英文文档 https://about.gitlab.com/downloads/ 清华大学tuna镜像源 G ...
- Android 英文文档下载地址
通过英文Android API学习Android技术是一个不错选择,当然养鸡的专业户要小心了,以下分享一些下载英文文档的链接(请使用迅雷下载): https://dl-ssl.google.com/a ...
- PHP-redis英文文档
作为程序员,看英文文档是必备技能,所以尽量还是多看英文版的^^ PhpRedis The phpredis extension provides an API for communicating wi ...
- python3 怎么统计英文文档常用词?(附解释)
# coding: utf-8 # In[32]: #import requests #from bs4 import BeautifulSoup #res = requests.get(" ...
随机推荐
- 用Fiddler在Android上抓包(Http+https)
Fiddler是一个HTTP协议调试代理工具,在开发网络应用的时候经常会用到,其最基本的作用是能抓HTTP的数据包,当然它还有更高级的用法,如添加断点.修改请求与相应的数据等等... 抓HTTP包 安 ...
- Get Form type using javascript in CRM 2011
Get from type var type = Xrm.Page.ui.getFormType(); getFromType() function returns integer value for ...
- Iterm2安装Zsh + Oh My Zsh+Solarized
安装Oh My Zsh curl -L https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh | sh 安装Zsh ...
- 高德地图SDK使用经验
下文说的是高德地图 Android SDK版本,详细版本如下: 2D地图:v2.3.1 定位:v1.3.0 导航:v1.1.1 发现的问题如下,其中一些疑是地图BUG,一些是需要你自己小心的地方: 1 ...
- shell脚本格式的几点注意:格式严格,空格不能随便出现(一写就记不住)
shell脚本中,不能随意添加空格,否则出错: 1,=等号两边必须无空格.否则出错.如i =$1和i= $1都是错的.但是在()内部不限制如for ((i= 1;i < 3;i= i+1))是正 ...
- Android平台根目录文件
> 系统分区 # adb shell # mount rootfs / rootfs ro 0 0 tmpfs /dev tmpfs rw,mode=755 0 0 devpts /dev/pt ...
- JavaScript检测提交表单text合法
近日,一朋友开设了地方性质的论坛,让我帮他处理下Login.php(所谓的用户的登陆页面),但是登陆的时候,出现空字符或敏感字符,需要提交到服务端的Script处理,大大降低了效率,于是乎,就有了此代 ...
- Struts2中的缓存----以Injector为例
题外话,文章中有大量的标识1 标识2,大家可以用ctrl+f来查找. 构成缓存的类 主要就是以下两个: com.opensymphony.xwork2.inject.util.ReferenceCac ...
- 关于iOS socket的讲解介绍
socket(套接字)是通信的基石,是支持TCP/IP协议的网络通信的基本操作单元,包含进行网络通信必须的五种信息:连接使用的协议,本地主机的IP地址,本地进程的协议端口,远地主机的IP地址,远地进程 ...
- 【Android 应用开发】自定义View 和 ViewGroup
一. 自定义View介绍 自定义View时, 继承View基类, 并实现其中的一些方法. (1) ~ (2) 方法与构造相关 (3) ~ (5) 方法与组件大小位置相关 (6) ~ (9) 方法与触摸 ...