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 <rep...@bugs.python.org>
<http://bugs.python.org/issue28878>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to