New submission from Ankit Dhebar:

code snippet
student_tuple = [ ('ykjsdf', 'A', 17, datetime.date(2014,10,15)), ('accjr', 
'C', 11, datetime.date(2013,05,05)), ('dgekw', 'B', 5, 
datetime.date(1987,03,03)) ]

Output for the above code works as expected.
o/p : [('dgekw', 'B', 5, datetime.date(1987, 3, 3)), ('accjr', 'C', 11, 
datetime.date(2013, 5, 5)), ('ykjsdf', 'A', 17, datetime.date(2014, 10, 15))]

but when you make one of the above datetime.date as 'None' like below

student_tuple = [ ('ykjsdf', 'A', 17, datetime.date(2014,10,15)), ('accjr', 
'C', 11, None), ('dgekw', 'B', 5, datetime.date(1987,03,03)) ]
 
o/p : TypeError: can't compare datetime.date to NoneType

In my opinion, the 'NoneType' should appear either in the beginning or towards 
the end after sorting is done.

----------
components: Tests
files: sorting_func.py
messages: 228543
nosy: pythoner
priority: normal
severity: normal
status: open
title: datetime comparison with 'None' returning a TypeError
type: compile error
versions: Python 2.7
Added file: http://bugs.python.org/file36809/sorting_func.py

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue22556>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to