A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2011-April/111013.html below:

[Python-Dev] PyObject_RichCompareBool identity shortcut

[Python-Dev] PyObject_RichCompareBool identity shortcut [Python-Dev] PyObject_RichCompareBool identity shortcutAlexander Belopolsky alexander.belopolsky at gmail.com
Thu Apr 28 09:30:10 CEST 2011
On Thu, Apr 28, 2011 at 2:54 AM, Nick Coghlan <ncoghlan at gmail.com> wrote:
..
> No, as Raymond has articulated a number of times over the years, it's
> a property of the equivalence relation that is needed in order to
> present sane invariants to users of the container. I included in the
> bug report the critical invariants I am currently aware of that should
> hold, even when the container may hold types with a non-reflexive
> definition of equality:
>
>  assert [x] == [x]                     # Generalised to all container types
>  assert not [x] != [x]                # Generalised to all container types
>  for x in c:
>    assert x in c
>    assert c.count(x) > 0                   # If applicable
>    assert 0 <= c.index(x) < len(c)      # If applicable
>

It is an interesting question of what "sane invariants" are.  Why you
consider the invariants that you listed essential while say

if c1 == c2:
   assert all(x == y for x,y in zip(c1, c2))

optional?

Can you give examples of algorithms that would break if one of your
invariants is violated, but would still work if the data contains
NaNs?
More information about the Python-Dev mailing list

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