Python: how to get a difference between all elements of the list with orignal indices saved

So lets suppose we have a list :

x = [0.2 , 0.1 , 0.3 , 0.100000001 , 0.200000002]

what I dont want to allow is difference between all the elements less than 1e-05 to be flagged as a True in the resulting list One way of doing would be to sort it first

   y =  x.sort()

   z= abs(np.diff(y))

  result = [False] + [i< 1e-5 for i in (z)]

so the resulting list is something like

[False True False True False]

but this way I lose the orignal positions in the resulting list, what I would want is a listwhich results in such a manner

[True True False True True]

Answer

You could just do something like:

>>> [any(abs(y - z) < 1e-5 for z in x if z != y) for y in x]
[True, True, False, True, True]
>>>