Skip to content

Commit 11140ef

Browse files
authored
Simplify resolution length check in arrangement.py
Refactor the resolution length check to remove try-except block.
1 parent f23f7fe commit 11140ef

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

src/sage/geometry/hyperplane_arrangement/arrangement.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3476,15 +3476,12 @@ def is_free(self, algorithm='singular') -> bool:
34763476
# Check if the last element is trivial and exclude it from the count.
34773477
resolution_length = len(mres)
34783478
if resolution_length > 0:
3479-
try:
3480-
sing = mres.parent()
3481-
last_elem = mres[resolution_length]
3482-
# Check if this element is the zero module using size()
3483-
size_val = int(sing.eval(f"size({last_elem.name()})"))
3484-
if size_val == 0: # Trailing zero module
3485-
resolution_length -= 1
3486-
except:
3487-
pass
3479+
sing = mres.parent()
3480+
last_elem = mres[resolution_length]
3481+
# Check if this element is the zero module using size()
3482+
size_val = int(sing.eval(f"size({last_elem.name()})"))
3483+
if size_val == 0: # Trailing zero module
3484+
resolution_length -= 1
34883485
return resolution_length <= 2
34893486
elif algorithm == "BC":
34903487
return self.derivation_module_free_chain() is not None

0 commit comments

Comments
 (0)