Switch to None or Exception for page_number / get_page_number / get_destination_page_number #2010
MartinThoma
started this conversation in
General
Replies: 1 comment
-
-1 is not an issue for me : it is consistent with functions like |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Explanation
If a page is not attached to a document, it does not have a page number. So we cannot return a "normal" number.
At the moment, we return
-1
.However, callers (users of the library) might not be careful with error handling.
For this reason I suggest to change the behavior to either return
None
or raise an Exception. I'm not sure what is better.Pro returning
None
:I think I want to tackle this with the pypdf==4.0.0 release (if we do it at all), but not earlier. So it will stay open for quite a while.
I want to have that release in early January 2024.
What is your opinion on the topic @pubpub-zz ?
Beta Was this translation helpful? Give feedback.
All reactions