Skip to content

Commit e3e67c8

Browse files
DEP: remove __next__ from Expr (#1169)
* Remove __next__ method from Expr class The __next__ method was removed from the Expr class, leaving only __iter__ for iteration. This simplifies the class and relies on the iterator protocol of self.terms. * Update CHANGELOG.md * Revert "Update CHANGELOG.md" This reverts commit ebc8cb4. * Remove __next__ method from Expr class stub The __next__ method was removed from the Expr class in the type stub file, likely because Expr is not intended to be an iterator. This change improves the accuracy of the type hints. --------- Co-authored-by: João Dionísio <57299939+Joao-Dionisio@users.noreply.github.com>
1 parent 2229b43 commit e3e67c8

File tree

2 files changed

+0
-5
lines changed

2 files changed

+0
-5
lines changed

src/pyscipopt/expr.pxi

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -202,10 +202,6 @@ cdef class Expr:
202202
def __iter__(self):
203203
return iter(self.terms)
204204

205-
def __next__(self):
206-
try: return next(self.terms)
207-
except: raise StopIteration
208-
209205
def __abs__(self):
210206
return abs(buildGenExprObj(self))
211207

src/pyscipopt/scip.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,6 @@ class Expr:
342342
def __mul__(self, other: Incomplete) -> Incomplete: ...
343343
def __ne__(self, other: Incomplete)-> Incomplete: ...
344344
def __neg__(self) -> Incomplete: ...
345-
def __next__(self) -> Incomplete: ...
346345
def __pow__(self, other: Incomplete, mod: Incomplete = ...) -> Incomplete: ...
347346
def __radd__(self, other: Incomplete) -> Incomplete: ...
348347
def __rmul__(self, other: Incomplete) -> Incomplete: ...

0 commit comments

Comments
 (0)