-
Notifications
You must be signed in to change notification settings - Fork 462
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
Refactor Burundi holidays #925
Conversation
13dd35c
to
303336b
Compare
303336b
to
e901559
Compare
e901559
to
3d9d253
Compare
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.
Marking as ready for beta!
Thank you!
for dt in _islamic_to_gre(year, 12, 10): | ||
self[dt] = "Eid al Adha" | ||
|
||
if self.observed: |
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 know we have similar code in other 15+ countries and it may look like a good approach (the code is compact and quite readable). However, that's not the way the observed holidays handling should be implemented.
As python-holidays
is a somewhat performance oriented library :) the goal is to focus on compatibility, performance, and code readability (probably, in this specific order).
The problem is in O(m*n) complexity for observed holidays logic. The more years you want to cover the longer it'll take (e.g., Burundi(years=range(1900, 2000)
vs Burundi(years=range(0, 2000)
). In general we try to avoid such kind of approaches.
I'm going to merge this PR as is as we'll need to tackle the entire problem anyway so one more country won't make a big difference. The main idea is to avoid applying the approach in future PRs.
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 thought about it. I want to try remake some of such countries with _add_with_observed()
mechanism (and individual processing rare cases).
Merged into beta! |
No description provided.