On 6/5/2012 3:17 PM, Guido van Rossum wrote: > On Tue, Jun 5, 2012 at 12:15 PM, Alexander Belopolsky > <alexander.belopolsky at gmail.com> wrote: >> On Tue, Jun 5, 2012 at 3:01 PM, Antoine Pitrou<solipsis at pitrou.net> wrote: >>> You could say the same about equally "confusing" results, yet equality never >>> raises TypeError (except between datetime instances): >>> >>>>>> () == [] >>> False >> >> And even closer to home, >> >>>>> date(2012,6,1) == datetime(2012,6,1) >> False >> >> I agree, equality comparison should not raise an exception. > > Let's make it so. 3.3 enhancement or backported bugfix? The doc strongly suggests that rich comparisons should return *something* and by implication, not raise. In particular, return NotImplemented instead of raising a TypeError for mis-matched arguments. "A rich comparison method may return the singleton NotImplemented if it does not implement the operation for a given pair of arguments. By convention, False and True are returned for a successful comparison. However, these methods can return any value," -- Terry Jan Reedy
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4