Skip to content

Commit 85c27cc

Browse files
committed
Namedtuple
1 parent 022e642 commit 85c27cc

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,13 +138,15 @@ Named Tuple
138138
-----------
139139
```python
140140
>>> Point = collections.namedtuple('Point', 'x y')
141-
>>> a = Point(1, y=2)
141+
>>> p = Point(1, y=2)
142142
Point(x=1, y=2)
143-
>>> a.x
143+
>>> p[0]
144144
1
145-
>>> getattr(a, 'y')
145+
>>> p.x
146+
1
147+
>>> getattr(p, 'y')
146148
2
147-
>>> Point._fields
149+
>>> Point._fields # Or: p._fields
148150
('x', 'y')
149151
```
150152

0 commit comments

Comments
 (0)