The Python Oracle

can't compare datetime.datetime to builtin_function_or_method

Become part of the top 3% of the developers by applying to Toptal https://topt.al/25cXVn

--

Music by Eric Matyas
https://www.soundimage.org
Track title: Magic Ocean Looping

--

Chapters
00:00 Question
01:22 Accepted answer (Score 6)
01:43 Thank you

--

Full question
https://stackoverflow.com/questions/3352...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#python #django #datetime

#avk47



ACCEPTED ANSWER

Score 6


datetime.date.today is not calling the function you think it is:

>>> import datetime
>>> datetime.date.today
<built-in method today of type object at 0x7fb681a90f80>  # NOT CALLING FUNCTION

>>> datetime.date.today()  # You need () at the end
datetime.date(2015, 11, 4) 

If you add the parentheses, you'll get the result you expect.