Skip to content

Commit 25bf725

Browse files
authored
poison __iter__ (#113)
Co-authored-by: MarcoGorelli <>
1 parent 399b5c4 commit 25bf725

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

spec/API_specification/dataframe_api/dataframe_object.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from __future__ import annotations
2-
from typing import Sequence, Union, TYPE_CHECKING
2+
from typing import Sequence, Union, TYPE_CHECKING, NoReturn
33

44
if TYPE_CHECKING:
55
from .column_object import Column
@@ -443,6 +443,18 @@ def __divmod__(self, other: DataFrame | Scalar) -> tuple[DataFrame, DataFrame]:
443443
"""
444444
...
445445

446+
def __iter__(self) -> NoReturn:
447+
"""
448+
Iterate over elements.
449+
450+
This is intentionally "poisoned" to discourage inefficient code patterns.
451+
452+
Raises
453+
------
454+
NotImplementedError
455+
"""
456+
raise NotImplementedError("'__iter__' is intentionally not implemented.")
457+
446458
def any(self, skipna: bool = True) -> DataFrame:
447459
"""
448460
Reduction returns a 1-row DataFrame.

0 commit comments

Comments
 (0)