Skip to content

Commit

Permalink
remove comparison with 0 using is
Browse files Browse the repository at this point in the history
  • Loading branch information
whoburg committed Jan 5, 2024
1 parent 79b6384 commit 518a7c0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions gpkit/nomials/math.py
Original file line number Diff line number Diff line change
Expand Up @@ -583,11 +583,11 @@ def as_hmapslt1(self, substitutions):
siglt0, = self.unsubbed
siglt0 = siglt0.sub(substitutions, require_positive=False)
posy, negy = siglt0.posy_negy()
if posy is 0: # pylint: disable=literal-comparison
if not posy: # posy is 0
print(f"Warning: SignomialConstraint {self} became the tautological"
f" constraint 0 <= {negy} after substitution.")
return []
if negy is 0: # pylint: disable=literal-comparison
if not negy: # negy is 0
raise ValueError(f"{self} became the infeasible constraint {posy} "
"<= 0 after substitution.")
if hasattr(negy, "cs") and len(negy.cs) > 1:
Expand Down

0 comments on commit 518a7c0

Please sign in to comment.