set()'s __and__ for list and str
This commit is contained in:
parent
87ead88610
commit
33c645ac04
@ -85,7 +85,17 @@ def intersection(self, *args) -> list:
|
||||
return list(ret)
|
||||
|
||||
|
||||
@hook(list)
|
||||
def __and__(self, *args) -> list:
|
||||
return self.intersection(*args)
|
||||
|
||||
|
||||
@hook(str)
|
||||
def intersection(self, *args) -> str:
|
||||
ret = set(self).intersection(*args)
|
||||
return "".join(list(ret))
|
||||
return "".join(list(ret))
|
||||
|
||||
|
||||
@hook(str)
|
||||
def __and__(self, *args) -> str:
|
||||
return self.intersection(*args)
|
||||
Loading…
Reference in New Issue
Block a user