举一个很S——B的例子来说明这本书的差劲之极_Python参考手册(第4版)书评-查字典图书网
查字典图书网
当前位置: 查字典 > 图书网 > 编程 > Python参考手册(第4版) > 举一个很S——B的例子来说明这本书的差劲之极
两个两个七 Python参考手册(第4版) 的书评 发表时间:2011-05-01 11:05:36

举一个很S——B的例子来说明这本书的差劲之极

第13章,第2节 copy
copy
The copy module provides functions for making shallow and deep copies of compound objects, including lists, tuples, dictionaries, and instances of user-defined objects.

copy(x)
Makes a shallow copy of x by creating a new compound object and duplicating the members of x by reference. For built-in types, it is somewhat uncommon to use this function. Instead, you use calls such as list(x), dict(x), set(x), and so forth to create a shallow copy of x (it should be noted that using the type name directly like this is
also significantly faster than using copy()).

后一句话的意思是: 值得注意的是,直接使用类型名的拷贝要比使用copy()显著的快很多。
翻译版:要知道像这样直接使用类型名显然要比copy()快很多。

批判:这个“显然”用在这里很不合适。没有那么显然,必须明确提示出来。显然个mao。这只是这一节的一个意思上的翻译不准。更S--b的在后边

deepcopy(x [, visit])
Makes a deep copy of x by creating a new compound object and recursively duplicating all the members of x. visit is an optional dictionary that’s used to keep track of visited objects in order to detect and avoid cycles in recursively defined data structures.This
argument is typically only supplied if deepcopy() is being called recursively as described later in this chapter.
意思: 创建x的深拷贝,通过创建一个新的复合对象并且递归地赋值x的所有成员。(请注意,是递归)。visit是可选的字典参数,用来跟踪被查看的对象,以探测和避免在递归的数据结构中的循环引用。这个参数只用于在deepcopy()被递归调用的情景中,就像下边描述的那样。

翻译: 通过创建新的复合对象并重复(傻逼了)赋值x的所有成员来创建x的深复制。visit是一个可选的字典,目的是跟踪受访问的对象,从而避免和检测重复(傻逼again)定义的数据结构中的循环。如本章稍后所述,如果重复(fuck)调用deepcopy(),通常只使用该参数。(此处极为fuck,意思tmd都前后不通了。应该是只有在这种情况下才使用该参数。)

Although it is not usually necessary, a class can implement customized copy methods by implementing the methods _ _copy_ _(self) and _ _deepcopy_ _(self, visit), which implement the shallow and deep copy operations respectively.The _ _deepcopy_ _() method must accept a dictionary, visit, which is used to keep track
of previously encountered objects during the copy process. It’s not necessary for _ _deepcopy_ _() to do anything with visit other than pass it to other deepcopy() operations carried out in the implementation (if any).
意思:虽不常见,但类可以定义__copy__和__deepcopy__方法,分别自定义对象实例的浅拷贝和深拷贝的行为。__deepcopy__必须有visit参数,用来跟踪在copy过程中已经遇到的对象。对于__deepcopy__来说,对visit的处理,除了在负责具体执行拷贝功能的被调用的deepcopy()函数间传递visit,不需要对它做其他事情。

翻译版的最后一句: 对于__deepcopy__(),除了将visit传递到实现中包含的其他deepcopy()方法之外,没有必要再执行其他操作。(fuck again,人意思是没有必要对visit做其他操作,不是__deepcopy()__没有必要做其他操作,人家不限制__deepcopy__()怎么实现,只是说visit参数的使用)
If a class implements the methods _ _getstate_ _() and _ _setstate_ _() that are used by the pickle module, they will be used by the copy module to create copies.

意思:如果类实现了__getstate__()和__setstate__()方法,这两个方法可以被pickle模块使用,这两个方法将被copy模块用来创建拷贝。
翻译:如果类实现了pickle模块所用的方法__getstate__()和...,(此处的翻译很不合适,不小心以为__getstate__是pickle定义的呢,当然细心点还是能理解正确,但是tmd汉语的表达太过于操蛋)


结论: 这只是一个小节。我以人格担保,这种类似错误在这本书分布地很均匀,而且密度很合理,合理到你没法流畅的阅读任何一章一节。译者,外语水平很差(4级都不容易过),中文水平很差(属于学校期间的笨学生)。

展开全文
有用 19 无用 4

您对该书评有什么想说的?

发 表

推荐文章

猜你喜欢

附近的人在看

推荐阅读

拓展阅读

对“举一个很S——B的例子来说明这本书的差劲之极”的回应

吴下阿蒙 2013-12-14 23:50:01

看了这帖子,感觉这书的中文翻译版太恐怖了。有误导性。

Skyler 2012-11-05 11:29:52

楼主豆瓣把你的书评也同步移植到了英文原版那儿了- -!
http://book.douban.com/subject/3273420/

-----------

喜感顿生啊...

吓人的鸟 2012-08-11 21:38:55

"错误不多,但分布均匀,导致无法流畅阅读"

搞得我很纠结到底要不要买....

swordscan 2012-05-01 23:40:10

最后一段话第一句很赞成,错误不多,但分布均匀,导致无法流畅阅读。

丹丹 2012-02-21 18:20:17

翻译版还将就,楼主的翻译不予评论,翻译的比翻译版还差。

小浩南哥 2011-11-28 15:01:36

晕,我看的时候竟然还觉得此书还行,结构每章小节很清晰,看来是俺还没看到点子上去呀。。。