voc icon indicating copy to clipboard operation
voc copied to clipboard

Duplicated values of equivalent but different data types in set

Open BPYap opened this issue 7 years ago • 1 comments

Consider the following code:

x = {1, 1.0, True}
for i in x:
    print(i)

Running it in Python 3.6 interpreter produces the following output:

1

Meanwhile running it in voc produces the following output:

1.0
1
True

According to this stack overflow topic, the value 1, 1.0 and True are equal when compared so Python will only keep 1 value in set.

BPYap avatar Jun 30 '18 06:06 BPYap

~~Fixed. Closing it now 😄~~

Edit: Oops, looks like I closed the wrong issue, reopening again.

BPYap avatar Jul 13 '18 06:07 BPYap