I wondered what was the recommended/prefered way of working with sets, for example a.difference(b)
vs a - b
, as in the first method it is clear we are working with sets, in the second not. However, the union
operator is |
, which isn't used for anything else.
Asked
Active
Viewed 21 times
0
-
2The union operator is bitwise OR. – Barmar Jun 06 '20 at 17:29
-
You are right, I forgot. – Jun 06 '20 at 17:30
-
PEP-218, which proposed the addition of sets, does not make any spcecific recommendation. Use your own judgement. – Barmar Jun 06 '20 at 17:32
-
I see, thanks for letting me know – Jun 06 '20 at 20:08