Skip to content

Make it possible to use multiple calendar settings in the same app. #6

@pmav99

Description

@pmav99

My current usecase does not fall in this category, but a relatively subtle implication of the current implementation is that it is not really possible to use different fiscal calendar settings in the same application. The problem is that as soon as you update the global settings, the behaviour of the existing objects changes too. For example:

In [2]: from fiscalyear import *

In [3]: y = FiscalYear(2018)

In [4]: y.start
Out[4]: FiscalDateTime(2017, 10, 1, 0, 0)

In [5]: setup_fiscal_calendar('same', 1, 1)

In [6]: y.start
Out[6]: FiscalDateTime(2018, 1, 1, 0, 0)

Arguably, someone could claim that this is a feature too! :P
And in certain contexts, it probably is! Neverheless, it can also lead to subtle bugs and various errors when you do calculations. If nothing else, I think that there should be at least a warning in the docs.

PS. The older I get the more I like immutable objects :P

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions