Giter VIP home page Giter VIP logo

Comments (2)

jaraco avatar jaraco commented on May 20, 2024

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.

jaraco avatar jaraco commented on May 20, 2024

If this feature would be of value to you, consider the calendra fork.

from workalendar.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.