RSS获取点

经营团队之我想

从大三在阿里巴巴实习到前不久在一家小于20人规模刚起步的小公司里任职了短短一个月时间。我也算比很多同龄人要经历得多了一点。在这篇日志里我要发表一下自己纯外行的见解,这些见解的出发点主要是结合上个月在那家小企业任职的实际情况,对他可能存在的一些问题做一个总结。

第一个出发点是激励的角度。说起激励很多经理人想到的可能首先是通过薪酬的角度,认为不停地提高工资可以增加员工的工作效率和忠诚度。但是事实上薪酬在激励上带来的实际效果并不一定如此得好。在有些描述员工激励的资料上通常会将薪酬激励放在比较低的层次,认为和其他几种激励方式相比显得地位很低,但是我认为也不能一概而论。人有多个层次的追求,首先是生存的追求。在最低生活水平能够得以保证的基础上,薪酬激励的效果才会逐渐下降。如果连饭都吃不饱,生活过得很拮据,失去了薪酬的激励效果其他效果就都成为了废品。而当一些员工在资金上已经没有了太大的顾虑的情况下,一味的涨工资并不能给他带来归属感和工作动力。再者,薪酬激励不光指提高薪酬,良好的薪酬激励还需要有合理的薪酬结构,工资,奖金,分成,以及其中的社保成份等合理且透明我认为是非常重要的。刚起步的小公司可能出于一些原因,开给员工的工资单分类笼统,缺乏合理的薪酬策略,或者缺少必需的社会保险来免去员工的一些后顾之忧,这带来的后果不容乐观。首先,对于薪酬浮动,员工不了解原因,只是简单得认为老板给我涨工资了,至于是为什么涨,哪一部分涨了都全然不知,这样的薪酬战略所起到的实际作用是要打折扣的。

其次,小公司在目标激励上可能不够重视。就我个人的实际经历来看,刚起步的小公司在企业的发展目标上花的力气不够多,大部分新员工和某些老员工可能对于企业的短期目标和远期目标不了解或比较模糊。一个没有共同目标的团队怎么可能能够把力气花到一个方向上呢?对于这一点,我觉得作为团队的领导者就应该时不时得和成员指出来。最好能做成大幅的条幅或者海报,挂在办公区域最显眼的地方。通过这种方式,团队成员就可以明确自己在完成这个目标过程中所起到的作用,使员工觉得他做的每一件事都会使自己和团队向着目标前进,当既定的短期目标完成所带来成就感将极大地提高他对团队的归属感,同时目标激励还能最大限度地把团队成员拧在一起,更好地进行合作。如果缺少了这种激励方式,员工可能在疲惫得工作了一天之后却感觉毫无收获和成就感,无非只是不停地重复机械操作而已,当工作内容的新鲜感逐渐消失,那么他对团队的忠诚也就开始打折,任何可以让他迈出跳槽这一步的风吹草动都将成为现实。再者,没有明确共同目标的团队,它的成员可能会向着自以为重要的目标前进,这将会在团队成员间的合作上带来巨大的阻力,更糟糕的结果可能会使团队走向岔路。

在激励上另一个重要的角度就是奖励和惩罚。一些成型的公司对员工会有明细的绩效考核,这个考核影响员工的薪酬、职业发展甚至是去留。而小公司由于缺少人力和可操作的考核手段(比如量化的考核方式),在这一方面可能予以漠视甚至忽略。另一方面,小公司在奖励和批评上往往来得不够透明,从而浪费了其可以起到的实际激励作用。当团队处于转折点或者面临困难时,合理的公开奖励和批评往往能起到很好的稳定军心的作用。如果团队出现大量突然而诡异的人事变动而又缺乏合理的解释时,很可能最终引起进一步的人事地震,把事情带向不利或更加不利的方向。

经营团队除了激励以外还需要很多别的东西。对于处于上升期的团队,规模不断扩大,他们可能面临的一个问题就是职能的划分和合理的工作流。当团队成员还非常少的时候,很多人都会身兼多职,而且人与人之间的交流路线也比较短,有效和容易。但随着人员增加,职能细分,以往的自由方式变得越来越糟糕,比较常见的情况就是混乱的人事安排,重叠的职能,不规范的工作流。这些可能导致团队资源的不合理分配(工作在熟练的人手里堆积,而新人得不到培养,资源被浪费;错误的工作流使生产过程中不停地遇到问题,缺乏充足的资料导致产品不断地回炉重构),影响产品质量和生产效率。

再一方面,小团队和大公司的巨大的落差可能就是文化。小团队很有可能没有或者缺少团队文化的支持。这里的文化不仅指对外的文化,更指对内的文化。缺乏团队文化的支持,团队的内部很有可能乱哄哄,拉帮结派或者死气沉沉。这些对于团队发展都是非常不利的。就比如说老板觉得团队的文化应该是诚信,那么你就不能光干不练,你就要多对员工进行诚信宣传,同时自己不要一天到晚吹牛皮,首先给自己先盖上个此人说话像放屁的印记。

最后,我还想提一下开源和节流的问题。前不久我还看到某位职业经理人提到开源节流的问题,感觉很有点道理。一个成功的团队或者企业,缺少了开源的精神可能是不行的,该搏的时候就该搏,该烧钱的地方就该烧,这个世界上想没有风险地获得巨大成功的事情几乎不存在,所以这个源必须能开,能舍得开,能会开。至于节流也是一样的道理,不花冤枉钱,不做没有收益的事情,才能把资源都用到刀口上。

"经营团队之我想"by banum2010-8-24 at 11:35 下午Comments [19]Tags: ,

学习Python第四版(四)

这一篇文章主要针对前言剩下部分内容中第四版与第三版区别的修订。主要将以表格方式呈现。下一篇学习Python的日志将正式开始正文。(译者注:以后所有的修订类的翻译都讲按本文的格式进行。)

翻译者:Banumgoogle

前言(续)

与3rd中区别的修订。
前言修订部分
在3版中文的页码 原文 修订
前言1 新的B if A else C条件表达式(第12章) 新的B if A else C条件表达式(第19章)
前言1 with/as环境管理器(第27章) with/as环境管理器(第33章)
前言2 统一try/except/fanilly(第27章) 统一try/except/fanilly(第33章)
前言2 相对导入语法(第21章) 相对导入语法(第23章)
前言2 生成器表达式(第17章) 生成器表达式(第20章)
前言2 新的生成器函数特性(第17章) 新的生成器函数特性(第20章)
前言2 函数装饰器(第26章) 生成器表达式(第31章)
前言2 新的生成器函数特性(第17章) 新的生成器函数特性(第20章)
前言2 新的内置函数:sort、sum、any、all、
enumerate(第4章和第13章)
新的内置函数:sort、sum、any、all、
enumerate(第13章和第14章)
前言2 新的生成器函数特性(第17章) 新的生成器函数特性(第20章)
前言2 文件、列表解析和迭代器等新的扩展内容(第13章和第17章) 文件、列表解析和迭代器(第14章和第20章)
前言2 新的开发工具:Eclipse、distutils、unittest和doctest、IDLE加强版、Shedskin等(第3章和第29章) 新的开发工具:Eclipse、distutils、unittest和doctest、IDLE加强版、Shedskin等(第2章和第35章)
前言2 详细的OOP介绍(第22章) 详细的OOP介绍(第25章)
前言3 这种新结构….读者产生恐惧 这种新结构….读者产生恐惧
前言3 练习题解答在附录B 章节后的习题将直接出现在习题的最后,这和练习题不同,后者的答案在附录B
前言3 在适当的地方,…掩盖了基础知识 在适当的地方,…掩盖了基础知识
前言4 其他书籍…《Python Pocket Reference》 其他书籍
前言4 因为本书的侧重点…练习题(参考第29章) 因为本书的侧重点…练习题(参考第29章)
前言6 习题和练习题的解答在附录B 习题的解答在每章的最后,而练习题的答案则在附录B
前言6 附录B的解答应该可以帮助你 章节后和附录B中的解答应该可以帮助你
前言7 第8部分 新的第8部分,原附录成为第9部分。新添加部分将在表后附一中给出
前言8 关于本书的程序 第一段文字被重写了。在附二中给出
前言8 迎接Python3.0 此部分被删
附一

Part VIII, Advanced Topics (new in the fourth edition)

第8部分,高级主题(4版中全新)

In the final part, we explore some advanced topics. Here, we study Unicode and byte strings, managed attribute tools like properties and descriptors, function and class decorators, and metaclasses. These chapters are all optional reading, because not all programmers need to understand the subjects they address. On the other hand, readers who must process internationalized text or binary data, or are responsible for developing APIs for other programmers to use, should find something of interest in this part.

在最后一个部分,我们将探索一些高级的主题,在这一部分,我们将学习Unicode和Byte两种类型的字符串,管理特性工具(如properties和descriptors,函数和类装饰器,以及原类)。这些章节都是选读的,应为不是所有的程序员都需要了解这些内容。另一方面,对于那些需要处理国际化和二进制数据,或者负责为其他程序员开发api的读者,这个部分或许是他们感兴趣的。

附录二

This fourth edition of this book, and all the program examples in it, is based on Python version 3.0. In addition, most of its examples run under Python 2.6, as described in the text, and notes for Python 2.6 readers are mixed in along the way.

本书的第四版,以及所有其中提及的例子,都是基于Python3.0的。此外,大多数运行在Python2.6下的例子和针对Python2.6读者的笔记也将同时被提及。

译者的体例

读过Oreilly书的人都了解它的脚印(tips)和陷阱(warning)。为了能够在我的翻译中也表现出这些特点,我将使用斜体表示tips,用红色字体来表示warning。

"学习Python第四版(四)"by banum2010-8-14 at 12:11 下午Comments [1]Tags:

学习Python第四版(三)

即上一次更新隔了1个多礼拜。公司里项目跟进一时就没了时间,所以只好暂缓两天。今天将继续前言部分,并给前言一个结尾。还要给出一个说明,因为learning python的第三版的中文版已有成书,在这里获得,所以四版和三版的重复内容我将略过内容,不予以翻译,。但是如果有修订和更改,我将会特别得指出,并指明在3版中文版的页码,对应于4版原版的位置。

翻译者:Banumgoogle

前言(续)

3.0中被移除的部分

In addition to extensions, a number of language tools have been removed in 3.0 in an effort to clean up its design. Table P-2 summarizes the changes that impact this book, covered in various chapters of this edition. Many of the removals listed in Table P-2 have direct replacements, some of which are also available in 2.6 to support future migration to 3.0.

除了上文提到的扩展,有一些语言工具在3.0中被移除了,这样做是为了使架构更加清晰。这些改变将在表P-2中叙述,他们将覆盖这个版本的若干章节。有一些被移除的特性被直接替换了,还有一部分其实在2.6中已经提供了支持以方便未来向3.0迁移。

表P-2. 这本书涉及的3.0中的移除内容
移除内容 替换内容 覆盖的章节
reload(M) imp.reload(M) (or exec) 3, 22
apply(f, ps, ks) f(*ps, **ks) 18
`X` repr(X) 5
X <> Y X != Y 5
long int 5
9999L 9999 5
D.has_key(K) K in D (或者 D.get(key) != None) 8
raw_input input 3, 10
old input eval(input()) 3
xrange range 14
file open (以及 io 模型类库) 9
X.next X.__next__, 通过next(X)调用 14, 20, 29
X.__getslice__ X.__getitem__ 接受一个slice对象 7, 29
X.__setslice__ X.__setitem__ 接受一个slice对象 7, 29
reduce functools.reduce (或者使用循环语句) 14, 19
execfile(filename) exec(open(filename).read()) 3
exec open(filename) exec(open(filename).read()) 3
0777 0o777 5
print x, y print(x, y) 11
print >> F, x, y print(x, y, file=F) 11
print x, y, print(x, y, end=’ ‘) 11
u’ccc’ ‘ccc’ 7, 36
‘bbb’ for byte strings b’bbb’ 7, 9, 36
raise E, V raise E(V) 32, 33, 34
except E, X: except E as X: 32, 33, 34
def f((a, b)): def f(x): (a, b) = x 11, 18, 20
file.xreadlines for line in file: (或者X=iter(file)) 13, 14
D.keys()之类作为lists返回 list(D.keys()) (字典视图) 8, 14
map(), range(), 等作为lists返回 list(map()), list(range()) (内置) 14
map(None, …) zip (或者手动编码来 pad 结果) 13, 20
X=D.keys(); X.sort() sorted(D) (或者list(D.keys())) 4, 8, 14
cmp(x, y) (x > y) – (x < y) 29
X.__cmp__(y) __lt__, __gt__, __eq__,等 29
X.__nonzero__ X.__bool__ 29
X.__hex__, X.__oct__ X._index__ 29
Sort comparison functions 使用 key=transform 或 reverse=True 8
Dictionary <, >, <=, >= Compare sorted(D.items()) (或者使用循环) 8, 9
types.ListType list (types只针对于nonbuilt-in names) 9
__metaclass__ = M class C(metaclass=M): 28, 31, 39
__builtin__ builtins (改名) 17
Tkinter tkinter (改名) 18, 19, 24, 29, 30
sys.exc_type, exc_value sys.exc_info()[0], [1] 34, 35
function.func_code function.__code__ 19, 38
__getattr__ 以内置方式运行 在wrapper类中重新定义了__X__方法 30, 37, 38
-t, –tt 命令行替换 不正确的tab和空间使用总是返回一个错误 10, 12
from … *, within a function 可能只在文件的高层出现 22
import mod, in same package from . import mod, package-relative form 23
class MyException: class MyException(Exception): 34
异常模块(exceptions module) Built-in scope, library manual 34
thread, Queue modules _thread, queue (都被重命名了) 17
cPickle module _pickle (重命名了, 自动使用) 9
os.popen2/3/4 subprocess.Popen (os.popen保留) 14
基于字符串的错误 基于类的错误 (这点在2.6中已经被要求) 32, 33, 34
字符模块函数 字符对象方法 7
未绑定的方法 Functions(通过instance来调用静态方法) 30, 31
混合类型的比较和排序 非数字的混合类型比较会抛出错误 5, 9

There are additional changes in Python 3.0 that are not listed in this table, simply because they don’t affect this book. Changes in the standard library, for instance, might have a larger impact on applications-focused books like Programming Python than they do here; although most standard library functionality is still present, Python 3.0 takes further liberties with renaming modules, grouping them into packages, and so on. For a more comprehensive list of changes in 3.0, see the “What’s New in Python 3.0” document in Python’s standard manual set.

Python3.0中的其他一些变化没有在表中列出,因为它们对我们这本书没有影响。比如说,标准库中的一些变化,可能对面向于应用开发的书影响比较大,虽然大多数的标准库依然运作良好,Python3.0将在重命名、打包模块等方面拥有更多的自由。如果你想获取3.0中改变的进一步信息,请参阅Python标准手册中的”What’s New in Python 3.0″文档。

If you are migrating from Python 2.X to Python 3.X, be sure to also see the 2to3 automatic code conversion script that is available with Python 3.0. It can’t translate everything, but it does a reasonable job of converting the majority of 2.X code to run under 3.X. As I write this, a new 3to2 back-conversion project is also underway to translate Python 3.X code to run in 2.X environments. Either tool may prove useful if you must maintain code for both Python lines; see the Web for details.

如果你正从2.X版本迁移到3.X版本,请确保看看2to3自动代码转化脚本,这个脚本在Python3.0下可用。它不能翻译所有一切,但是可以让2.X中大多数的代码运行在3.X下。我写这本书的时候,新的3to2转化项目也在进行之中,目的在于转化3.X代码使它们能够运行在2.6环境下。两个工具也许能够在你必须维护两套Python版本时给与帮助。

Because this fourth edition is mostly a fairly straightforward update for 3.0 with a handful of new chapters, and because it’s only been two years since the prior edition was published, the rest of this Preface is taken from the prior edition with only minor updating.

因为第四版主要是对于3.0的更新提供新的少量章节,同时也因为离上一版出版才两年的时间,前言的剩下部分将从前一个版本中直接拿过来,只有极少量的更新。(译者注:剩下部分请参阅3版中文)

"学习Python第四版(三)"by banum2010-8-13 at 4:02 下午no CommentsTags:

学习Python第四版(二)

继续上次的工作,今天的翻译内容主要涉及4版和3版的新增章节。并且将会提及2.6和3.0中的改变和新特性。

翻译者:Banumgoogle

前言(续)

新添加的章节

Although the main purpose of this edition is to update the examples and material from the preceding edition for 3.0 and 2.6, I’ve also added five new chapters to address new topics and add context:

尽管这一版的主要目的是为了更新以前版本的例子和材料使之适应3.0和2.6,但我同时也新写了章节,在其中提及新的主题和内容。

  • Chapter 27 is a new class tutorial, using a more realistic example to explore the basics of Python object-oriented programming (OOP).
  • Chapter 36 provides details on Unicode and byte strings and outlines string and file differences between 3.0 and 2.6.
  • Chapter 37 collects managed attribute tools such as properties and provides new coverage of descriptors.
  • Chapter 38 presents function and class decorators and works through comprehensive examples.
  • Chapter 39 covers metaclasses and compares and contrasts them with decorators.
  • 第27章是新类的手册,增加了更实际的例子使读者更好地探索Python的面向对象编程基础。
  • 第36章详细介绍了Unicode和byte字符串,同时对字符串和文件在3.0和2.6中的不同提供了一个概述。
  • 第37章收集了一些属性管理工具。这些工具涉及性能并提供了一个新的描述。
  • 第38章通过全面的实例讲述了函数和类描述符。
  • 第39章涵盖了原类,同时将原类和类描述符进行了比较。

The first of these chapters provides a gradual, step-by-step tutorial for using classes and OOP in Python. It’s based upon a live demonstration I have been using in recent years in the training classes I teach, but has been honed here for use in a book. The chapter is designed to show OOP in a more realistic context than earlier examples and to illustrate how class concepts come together into larger, working programs. I hope it works as well here as it has in live classes.

这些章节首先提供一个循序渐进的指南,来讲述Python如何使用类和面向对象编程。这些指南基于我这些年在培训课上使用的现场演示,但是入书时已经经过了磨砺。这些章节被设计为以更现实的文字来展现面向对象编程,来描述类的概念如何组成一个更大的、运行中的程序。我希望这些指南能够像在现场授课一样奏效。

The last four of these new chapters are collected in a new final part of the book, “Advanced Topics.” Although these are technically core language topics, not every Python programmer needs to delve into the details of Unicode text or metaclasses. Because of this, these four chapters have been separated out into this new part, and are officially optional reading. The details of Unicode and binary data strings, for example, have been moved to this final part because most programmers use simple ASCII strings and don’t need to know about these topics. Similarly, decorators and metaclasses are specialist topics that are usually of more interest to API builders than application programmers.

后面四个章节被收录在本书最后新添加的大部分中,即“高级主题”,虽然这些内容理论上其实属于核心编程的主题,但是并不是每一个Python程序员都需要深入了解Unicode和原类。正因为这个原因,这4个章节被划分到新的部分,以供选读。比如说,相对于Unicode和二进制字符串处理,其实大多数程序员都仅仅使用ASCII字符串,所以既然大多数人都不理会这些主题我们就把它移到了新的部分。同样,装饰器和原类这些特殊主题,或许API制作者会比应用开发者更感兴趣。

If you do use such tools, though, or use code that does, these new advanced topic chapters should help you master the basics. In addition, these chapters’ examples include case studies that tie core language concepts together, and they are more substantial than those in most of the rest of the book. Because this new part is optional reading, it has end-of-chapter quizzes but no end-of-part exercises.

如果你使用这些工具,或者你使用的代码中提及了这些,那么这些新的主题将会帮助你掌握基础。此外,这些章节的例子配合核心编程思想提供了案例研究,这样的案例研究会比书中剩下那些章节中提到的要多。因为这些章节是选读的,所以将只提供了章节测试。

已有材料的改变

In addition, some material from the prior edition has been reorganized, or supplemented with new examples. Multiple inheritance, for instance, gets a new case study example that lists class trees in Chapter 30; new examples for generators that manually implement map and zip are provided in Chapter 20; static and class methods are illustrated by new code in Chapter 31; package relative imports are captured in action in Chapter 23; and the __contains__, __bool__, and __index__ operator overloading methods are illustrated by example now as well in Chapter 29, along with the new overloading protocols for slicing and comparison.

此外,为了支持新的实例,旧版本的材料已经被重做了。比如说,30章中的多重继承有了一个新的学习案例,这个案例演示了一个树类;在20章中提到了一个手动实现map和zip的生成器;在31章中,静态和类方法将使用新的编码方式展现;23章中展现了包相对依赖;__contains__、__bool__以及__index__这些操作符的重载方法将会在29章通过例子来描述,这个方法和新的切片和比较的重载协议有关。

This edition also incorporates some reorganization for clarity. For instance, to accommodate new material and topics, and to avoid chapter topic overload, five prior chapters have been split into two each here. The result is new standalone chapters on operator overloading, scopes and arguments, exception statement details, and comprehension and iteration topics. Some reordering has been done within the existing chapters as well, to improve topic flow.

这个版本出于清晰起见,对章节进行了重新组织。比如说为了适应新的材料和主题的加入,防止章节主题过载,过去的5个章节分别被分割为2个部分。这个结果导致了新的独立的章节的产生,涉及运算符重载、scope和arguments、异常状态申明、以及comprehension和迭代主题(译者注:部分不确定术语使用原文)。有些改变发生在已经存在的章节来提高主题的流畅性。

This edition also tries to minimize forward references with some reordering, though Python 3.0’s changes make this impossible in some cases: to understand printing and the string format method, you now must know keyword arguments for functions; to understand dictionary key lists and key tests, you must now know iteration; to use exec to run code, you need to be able to use file objects; and so on. A linear reading still probably makes the most sense, but some topics may require nonlinear jumps and random lookups.

这个版本同时尝试通过重新组织减少向前引用,尽管依据Python3.0的特性在一些代码中这是很难做到的:比如你必须了解方法的keyword参数才能理解打印和字符串格式化;你必须了解迭代器才能理解字典的key列表和测试;你需要能够使用文件对象,才能使用exec来运行代码等等。一个线性的阅读顺序是非常有意义的,但是有些主题可能需要非线性的跳跃和查找。

All told, there have been hundreds of changes in this edition. The next section’s tables alone document 27 additions and 57 changes in Python. In fact, it’s fair to say that this edition is somewhat more advanced, because Python is somewhat more advanced. As for Python 3.0 itself, though, you’re probably better off discovering most of this book’s changes for yourself, rather than reading about them further in this Preface.

总的来说,在这个版本中会有上百个改变。下一节的表格将展示Python3.0的27个新的增加和57个改变。事实上,可以说这个版本更加进一步,因为Python3.0也更进一步了。你最好自己去探索这本书中的改变,而不是这么早就在前言中读到他们。

2.6和3.0中的具体语言扩展

In general, Python 3.0 is a cleaner language, but it is also in some ways a more sophisticated language. In fact, some of its changes seem to assume you must already know Python in order to learn Python! The prior section outlined some of the more prominent circular knowledge dependencies in 3.0; as a random example, the rationale for wrapping dictionary views in a list call is incredibly subtle and requires substantial foreknowledge. Besides teaching Python fundamentals, this book serves to help bridge this knowledge gap.

一般来说,Python3.0比以往的更加清晰,但是在某些方面他也显得更加复杂。事实上,部分变化甚至需要你事先已经了解Python才能学习!前一个章节我们叙述了一些比较重要的3.0需要的背景知识;比如说,在列表调用中使用字典视图包装的理由是非常微妙,这需要相当的经验知识。除了教授Python的基础,这本书也旨在缩小这些知识的差距。

Table P-1 lists the most prominent new language features covered in this edition, along with the primary chapters in which they appear.

表P-1列出了这个版本所有重要的语言特性,同时也指出了这些特性出现的主要章节。(译者注:对于不了解的特性没有翻译。)

表P-1。Python2.6和3.0的语言扩展
扩展内容 覆盖章节
3.0中的print函数 11
3.0中的外部变量x,y声明 17
2.6和3.0中的str.format方法 7
3.0中的字符串类型:

对于Unicode是str,对于二进制数据是bytes

7、36
文本和二进制文件在3.0中的区别 9、36
2.6和3.0中的类装饰器:

@private(‘age’)

31、38
3.0中的新迭代器:

range, map, zip

14、20
3.0中的字典视图(Dictionary views):

D.keys, D.values, D.items

8、14
3.0中的除法运算符:

remainders, / 和 //

5
3.0中的集合(set)写法:

{a, b, c}

5
3.0中的集合解析(set comprehensions):

{x**2 for x in seq}

4、5、14、20
3.0中的字典解析(Dictionary comprehensions):

{x: x**2 for x in seq}

4、8、 14、20
二进制数字字符串在2.6和3.0中的支持:

0b0101, bin(I)

5
2.6和3中的分数数字类型:

Fraction(1, 3)

5
3.0中的函数注解(Function annotations):

def f(a:99, b:str)->int

19
3.0中参数arg只能以关键字参数(keyword-only)形式:

def f(a, *b, c, **d)

18、20
3.0中扩展的序列拆包(sequence unpacking):

a, *b = seq

11、13
包相对引入语法在3.0中有效:

from .

23
2.6和3.0中Context管理器有效:

with/as

33、35
3.0中异常处理语法改变:

raise,except/as,superclass

33、34
3.0中的异常链(Exception chaining):

raise e2 from e1

33
2.6和3.0中保留字的变化 11
New-style class cutover in 3.0 31
2.6和3.0中的属性装饰器(property decorators):

@property

37
Descriptor use in 2.6 and 3.0 31、38
2.6和3.0中的元类(Metaclass)使用 31、39
抽象基类在2.6和3.0中的支持 28
"学习Python第四版(二)"by banum2010-8-2 at 12:59 下午no CommentsTags: , ,

Powered by WordPress