SET
Description
The set
operator converts a list to a set (in the Python sense).
Example removing Duplicates
list(set([1, 1, 1]))
Returns [1]
since a set cannot contain duplicates
Example to speed-up Rules
large_list := set([87, 737, ..., 1])
42 in large_list
will evaluate much faster than directly doing in
on the list, since a set can check if something is part of it in O(1) (see Big O Notation)
Last updated
Was this helpful?