Skip to content

Commit e16804a

Browse files
authored
Merge pull request yasoob#173 from gabycasper007/master
Last __getitem__ example
2 parents 3cf1eec + 3cae4cb commit e16804a

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

classes.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,8 @@ Implementing **getitem** in a class allows its instances to use the []
200200
def __getitem__(self,i):
201201
return self.info[i]
202202
203-
foo = OldClass()
204-
foo['title']
203+
foo = GetTest()
204+
foo['name']
205205
# Output: 'Yasoob'
206206
207207
foo['number']
@@ -211,7 +211,7 @@ Without the ``__getitem__`` method we would have got this error:
211211

212212
.. code:: python
213213
214-
>>> foo['title']
214+
>>> foo['name']
215215
216216
Traceback (most recent call last):
217217
File "<stdin>", line 1, in <module>

0 commit comments

Comments
 (0)