Skip to content

Commit e689f0b

Browse files
author
MarcoGorelli
committed
add __len__ and __getitem__ to Column
1 parent d10a096 commit e689f0b

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed
Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,24 @@
1+
from typing import NoReturn
2+
13
class Column:
2-
pass
4+
def __len__(self) -> int:
5+
"""
6+
Return the number of rows.
7+
"""
8+
9+
def __getitem__(self, row) -> object:
10+
"""
11+
Get the element at row index `row`.
12+
"""
13+
14+
def __iter__(self) -> NoReturn:
15+
"""
16+
Iterate over elements.
17+
18+
This is intentionally "poisoned" to discourage inefficient code patterns.
19+
20+
Raises
21+
------
22+
NotImplementedError
23+
"""
24+
raise NotImplementedError("'__iter__' is intentionally not implemented.")

0 commit comments

Comments
 (0)