-
Notifications
You must be signed in to change notification settings - Fork 930
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
utils.py: Fixing assertion in drange to allow equal inputs #246
Conversation
We should allow drange to allow the same input value for v0 and v1. In this case, drange will return an iterator of one element: v0 // d.
This change would make
Changing Rather I would like |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this PR solves a problem in an unsatisfying manner.
drange
should never throw an AssertionError
when the inputs are wrong. It should return an empty list just like the builtin range
.
@abhmul this is just a small change, can you do it?
Sure, I can do it this week, should be a quick fix. |
I've checked and there is no |
This reverts commit df4b2cf
We should allow
drange
to allow the same input value forv0
andv1
. In this case,drange
will return an iterator of one element:v0 // d
.I ran into an issue when using Camelot, where the values passed into
v0
andv1
were the same. The original assertion indrange
will fail when values forv0
andv1
are the same. However, I don't see why they can't be the same. In this case,drange
will return arange
iterator with just a single element equal tov0 // d
. Making this change fixed the assertion without any incorrect change in the output of my code.I am not very familiar with the codebases of
pdfminer
orCamelot
, so I'd like an active contributor to take a look and see if there are any obvious issues. In the meanwhile, I'll continue to do some more investigation to see if this change could pose a problem somewhere, and I'll update this PR with anything I find.