PS:图片出自@fluentpython官推,简体中文版最薄,巧合占据C位。根据图灵教育统计,简体中文版销量超过4万册,预计在2020年能超越英文版的销量。
Python猫
公众号回复『流畅』,有完整的高清原图)原图太大,展示不下。在
Python猫
公众号内回复『流畅』,有完整的高清原图、PDF 版本和 MarkDown 版本
import collections
Card = collections.namedtuple('Card', ['rank', 'suit'])
class FrenchDeck:
ranks = [str(n) for n in range(2, 11)] + list('JQKA')
suits = 'spades diamonds clubs hearts'.split()
def __init__(self):
self._cards = [Card(rank, suit) for suit in self.suits for rank in self.ranks]
def __len__(self):
return len(self._cards)
def __getitem__(self, position):
return self._cards[position]
《流畅的Python》作者与中文版合影
http://www.hongweipeng.com/index.php/archives/1345 (by hongweipeng)