[Python-Dev] Re: Comparing dict.values()

2019年7月25日 08:57:45 -0700

On 2019年7月24日 19:09:37 -0400
David Mertz <[email protected]> wrote:
> 
> There are various possible behaviors that might make sense, but having
> `d.values() != d.values()` is about the only one I can see no sense in.
Why? Does the following make no sense to you?
>>> iter(()) == iter(())
False
Python deliberately allows you to compare everything with everything,
at least for equality. Perhaps it shouldn't, but it's too late to
design the language differently.
> This feels similar to NumPy arrays, that also will not compare for equality
> in bare form.
They will, but then they return an array of booleans.
>>> a = np.array([1,2]) 
>>> b = np.array([1,3]) 
>>> a == b 
array([ True, False])
Regards
Antoine.
_______________________________________________
Python-Dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/22MR5JGSMPOES6FJMVFTBOOMRXCU7DIK/

Reply via email to