On 12/8/2011 1:54 PM, Duncan Booth wrote:
Yes, the documentation describes this although I don't think anything
highlights that it is a change from Python 2.x:
[http://docs.python.org/py3k/reference/datamodel.html]
The Python 3 docs are 're-based' on 3.0, with change notes going forward
from
Chris Angelico wrote:
> On Fri, Dec 9, 2011 at 4:32 AM, Peter Otten <__pete...@web.de> wrote:
>> The only thing that has changed (in 2.7) is the algorithm to
>> calculate the hash value. The bits are rotated to turn the four least
>> significant bits into the most signicant ones. According to a c
Chris Angelico wrote:
> On Fri, Dec 9, 2011 at 4:32 AM, Peter Otten <__pete...@web.de> wrote:
>> The only thing that has changed (in 2.7) is the algorithm to calculate
>> the hash value. The bits are rotated to turn the four least significant
>> bits into the most signicant ones. According to a co
On Fri, Dec 9, 2011 at 4:32 AM, Peter Otten <__pete...@web.de> wrote:
> The only thing that has changed (in 2.7) is the algorithm to calculate the
> hash value. The bits are rotated to turn the four least significant bits
> into the most signicant ones. According to a comment in Objects/objects.c
>
Chris Angelico wrote:
> It checks for equality using hashes. By default, in Python 2, objects'
> hashes are their ids - meaning that no two of them hash alike, and
> you'll get duplicates in your set. (In Python 3, the default appears
> to be that they're unhashable and hence can't go into the set
Andrea Crotti wrote:
> I've wasted way too much time for this, which is surely not a Python bug,
> not something that surprised me a lot.
>
> I stupidly gave for granted that adding an object to a set would first
> check if there are equal elements inside, and then add it.
>
> As shown below thi
On Fri, Dec 9, 2011 at 3:34 AM, Andrea Crotti wrote:
> I've wasted way too much time for this, which is surely not a Python bug,
> not something that surprised me a lot.
>
> I stupidly gave for granted that adding an object to a set would first
> check if there are equal elements inside, and then