[issue28878] datetime should not be a subclass of date

2016-12-05 Thread sergem

New submission from sergem:

I have Python 3.5.2.

datetime is implemented as a subclass of date
(isinstance(datetime.datetime(2015,1,1), datetime.date) == True)

I suppose that violates Liskov substitution principle:

1. datetime and date cannot be compared via "<".
2. both of these classes have "isoformat()" method. And the meaning of these 
methods differ.

It means one cannot pass datetime to the function that expects date.

Also one cannot say that datetime "is a" date. 

I suppose datetime must not be a subclass of date.

------
messages: 282416
nosy: sergem
priority: normal
severity: normal
status: open
title: datetime should not be a subclass of date
versions: Python 3.5

___
Python tracker 
<http://bugs.python.org/issue28878>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28878] datetime should not be a subclass of date

2016-12-05 Thread sergem

sergem added the comment:

Would you be so kind to point to me to the discussion/arguments for that 
choice? 

Also 
http://www.gossamer-threads.com/lists/python/python/1114426

--
resolution: not a bug -> 

___
Python tracker 
<http://bugs.python.org/issue28878>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com