canvasapi
canvasapi copied to clipboard
Issue/539 typed paginated list
Original PR (#539) from garth74:
This pull request makes two changes:
Adds type hinting to PaginatedList so that elements used in for-loops, list comprehensions, etc. are typed (more info). Adds negative indexing to PaginatedList.
Related Supports efforts of https://github.com/ucfopen/canvasapi/pull/435 and fixes https://github.com/ucfopen/canvasapi/issues/305 without preventing negative indexing all together (i.e., https://github.com/ucfopen/canvasapi/pull/306).
Updated to include upstream changes in develop since the original was opened in 2022.
I think there are two things worth discussing:
- The typing improvements will help. I think
PaginatedListis one of the harder bits of the library to get right if you've never used it before. It might help users in more complex cases avoid gotchas. - My concern is about negative indexing large lists. It still has to get all of the results before you can access the results. Should we (I?) put in some more effort to address the other related issues (see #114, #237, and #175.)