Leading 0's syntax error in datetime.date module (Python 3.6)

AK akarpierz at gmail.com
Thu May 10 08:05:44 EDT 2018


On 2018-05-10 13:52, D'Arcy Cain wrote:
> On 2018-05-10 07:39 AM, AK wrote:
>> Try (should work from both PY2 and PY3):
>>
>> d0 = date(2018,0o2,0o1)
> 
> Bad advice.  Those numbers are decimal, not octal,  You should use
> "date(2018,2,1)" here.  Works in PY2, PY3 and for my birthday, Sept 4.

It was only an evidence that it was PY3/PY2 compatibility issue - not a 
solution/correct way.
Of course simple use of decimal constants like date(2018, 2, 1) is most 
correct.

AK



More information about the Python-list mailing list