9 ms·
".intersection()" takes any iterable, it can be: if set(args).intersection(["-h", "--help"]): Also python has had a special syntax for sets since 2.7 (I t
by Izkata 2y ago
".intersection()" takes any iterable, it can be:
if set(args).intersection(["-h", "--help"]):
Also python has had a special syntax for sets since 2.7 (I think), though I haven't seen it used very often:
if {"-h", "--help"}.intersection(args):
- atoav 2y agoIt makes so much sense to think about this as sets, thanks