> On Jan 17, 2019, at 16:13, Peter Otten <__pete...@web.de> wrote:
>
> David Rock wrote:
>
>> both a and nan are floats, so why does a == a work, but nan == nan
>> doesn’t?
>
> It does "work", it's only produces a result you didn't expect ;)
> Python just follows the standard here
>
> https:/
David Rock wrote:
>
>> On Jan 17, 2019, at 13:40, Peter Otten <__pete...@web.de> wrote:
>>
>> David Rock wrote:
>>
>>>
>>> Isn’t this a bit artificial, though? The reason this is False is
>>> because
>>> you explicitly tell it to return False when using equality. That’s not
>>> the same thin
On Thu, Jan 17, 2019 at 03:05:17PM -0600, David Rock wrote:
> In [7]: nan == nan
> Out[7]: False
>
> In [8]: a = 1.1
>
> In [9]: a ==a
> Out[9]: True
> both a and nan are floats, so why does a == a work, but nan == nan
> doesn’t?
They both "work", because they both do what they are designed
> On Jan 17, 2019, at 13:40, Peter Otten <__pete...@web.de> wrote:
>
> David Rock wrote:
>
>>
>> Isn’t this a bit artificial, though? The reason this is False is because
>> you explicitly tell it to return False when using equality. That’s not
>> the same thing as using __eq__ without overrid
David Rock wrote:
>
>> On Jan 17, 2019, at 12:39, Peter Otten <__pete...@web.de> wrote:
>>
>> One obscure detail of the implementation of list equality:
>>
>> In Python an object can be unequal to itself:
>>
> class A:
>> ... def __eq__(self, other): return False
>> ...
> a = A()
>
> On Jan 17, 2019, at 12:39, Peter Otten <__pete...@web.de> wrote:
>
> One obscure detail of the implementation of list equality:
>
> In Python an object can be unequal to itself:
>
class A:
> ... def __eq__(self, other): return False
> ...
a = A()
a == a
> False
Isn’t this
One obscure detail of the implementation of list equality:
In Python an object can be unequal to itself:
>>> class A:
... def __eq__(self, other): return False
...
>>> a = A()
>>> a == a
False
However, the list assumes that (a is a) implies a == a, so
>>> [a] == [a]
True
Alan Gauld via Tutor wrote:
> On 17/01/2019 07:24, Maninath sahoo wrote:
> a=[100,50,30]
> b=[100,90,3]
> a > True
> a>b
> > False
> >
> >
>> How it compares between two lists
>>
> The algorithm is probably described somewhere in the documentation
> but my understanding is that
On Thu, Jan 17, 2019 at 09:57:03AM +, Alan Gauld via Tutor wrote:
> The algorithm is probably described somewhere in the documentation
> but my understanding is that it looks something like this(in pdeudo code):
List, tuple and string comparisons are defined as lexicographical order:
http://
CCing the list. Please use Reply All or Reply List on responses to the list.
On 17/01/2019 07:24, Maninath sahoo wrote:
a=[100,50,30]
b=[100,90,3]
a True
a>b
> False
>
>
> How it compares between two lists
>
The algorithm is probably described somewhere in the documentation
b
10 matches
Mail list logo