Skip to content
This repository was archived by the owner on Apr 11, 2025. It is now read-only.

Conversation

@bosd
Copy link
Collaborator

@bosd bosd commented Oct 30, 2024

  1. Variable Initialization: We store len(self.rows) and len(self.cols) in num_rows and num_cols respectively to avoid recalculating these values on each iteration.

  2. Error Handling: Before trying to set borders, we check if the number of rows and columns is valid. If either is zero, the method returns early. Additionally, we check if self.cells has the expected structure. If not, we raise a ValueError.

  3. Looping through Indices: Instead of using enumerate(), use a simple range() loop since we only need the index and not the item itself. This can enhance readability and possibly performance.

@bosd bosd added bug Something isn't working performance Performance labels Oct 30, 2024
@bosd bosd marked this pull request as ready for review October 30, 2024 21:50
1. **Variable Initialization**: We store `len(self.rows)` and `len(self.cols)` in `num_rows` and `num_cols` respectively to avoid recalculating these values on each iteration. 2. **Error Handling**: Before trying to set borders, we check if the number of rows and columns is valid. If either is zero, the method returns early. Additionally, we check if `self.cells` has the expected structure. If not, we raise a `ValueError`. 3. **Looping through Indices**: Instead of using `enumerate()`, use a simple `range()` loop since we only need the index and not the item itself. This can enhance readability and possibly performance.
@bosd bosd merged commit ad4a79c into py-pdf:main Oct 31, 2024
14 checks passed
@bosd bosd deleted the ref-set-border branch October 31, 2024 17:32
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

bug Something isn't working performance Performance

1 participant