We got an issue in django-jalali that needs adding fold attribute to jdatetime.datetime. (fold has been added in python 3.6)
fold is a keyword-only argument and Python 2.7 doesn't support keyword-only argument. So, we have to create multiple constructors for this class(one for python<3.5 and one for python >=3.6) or get in *kwargs which is not compatible with cpython implementation
we have to raise AttributeError when the fold is called in python < 3.6:
Python 2.7.18 (default, Jul 14 2021, 08:11:37)
[GCC 10.2.1 20210110] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from datetime import datetime
>>> dt = datetime.today()
>>> dt.fold
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'datetime.datetime' object has no attribute 'fold'
The python version checking has to be done in __init__, replace, fold attribute and also in tests.
We got an issue in django-jalali that needs adding fold attribute to
jdatetime.datetime
. (fold has been added in python 3.6)fold
is akeyword-only
argument and Python 2.7 doesn't supportkeyword-only
argument. So, we have to create multiple constructors for this class(one for python<3.5 and one for python >=3.6) or get in*kwargs
which is not compatible with cpython implementationwe have to raise
AttributeError
when thefold
is called in python < 3.6:The python version checking has to be done in
__init__
,replace
,fold
attribute and also in tests.I think we can drop the older python version now.
What do you think @slashmili @farzadghanei