Skip to content

Commit 86ab6dc

Browse files
authored
Merge pull request #6 from xudong07/xudong07-patch-1
Update 2.2.md
2 parents bc68dc3 + 2379ce5 commit 86ab6dc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

2.2.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,9 @@ Python 中的元组(以及多数其它编程语言中的序列)下标都以
110110
>>> def make_rat(n, d):
111111
return (n, d)
112112
>>> def numer(x):
113-
return getitem(x, 0)
113+
return x.__getitem__(0)
114114
>>> def denom(x):
115-
return getitem(x, 1)
115+
return x.__getitem__(1)
116116
```
117117

118118
用于打印有理数的函数完成了我们对抽象数据结构的实现。

0 commit comments

Comments
 (0)