Comments (2)
My original hope was that the PR would better justify and elucidate the purpose of this ticket, but because the PR is being rejected, I want to elaborate.
The use of tuples as implicit types also has ramifications for readability. The existing implementation is using tuples to "extend" the concept of date to also have a label, but this approach has two limitations.
First, it requires any user of these new date types to know that it is a tuple and to infer the meaning of the items in the tuple. Even a namedtuple would be better. Instead, you see code like this, that looks more like Lisp than Python:
days.append((date(year, month, day), label))
You also find code like this which must assign names to the parts of the tuple in order to reference just one relevant part of it:
set([day for day, label in self.holidays(year)])
The second problem that arises is that there's no way for a client library or consumer of this library to extend the meaning of those constructs. Because they're tuples which have a specific meaning, providing additional detail, such as a observance shift, is simply not possible.
from workalendar.
If this feature would be of value to you, consider the calendra fork.
from workalendar.
Related Issues (20)
- missing one day of Seollal for year 2023
- lost day in get_working_days_delta when start==end
- New Release Required HOT 2
- International Women's Day in MV/Germany (Mecklenburg-Vorpommern)
- Coronation of King Charles III not included in UK bank holidays HOT 1
- Holiday error in South Korea HOT 3
- Lazily import region modules as required
- CzechRepublic: 2023-07-01 .. 2023-08-01 reports 20 working days while there are 19
- Some Japanese national holidays are missing
- Add Matariki to NZ Calendar
- Include declared one-time holidays
- Victory over Japan Day
- When can China's 2024 calendar be updated HOT 3
- Danish public holiday "Store Bededag" no longer observed as of 2024
- Workalendar 17.0.0 cal = Ireland Returning Incorrect Date & Holiday Name
- The 2024 Chinese calendar is not updated yet. HOT 2
- Ireland missing St Brigid's Day
- Vietnam Calendar?
- datetime64[ns] is of unsupported type
- Days in lieu when holiday falls on weekend
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from workalendar.