Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

intersection #23

Open
stephanelsmith opened this issue Jun 5, 2020 · 1 comment
Open

intersection #23

stephanelsmith opened this issue Jun 5, 2020 · 1 comment

Comments

@stephanelsmith
Copy link

intersection doesn't seem to perform correctly. Intersecting a simple list of strings results in [].

Simple fix was to remove the first 4 lines where there's a test for 'int', then a wrap into a tuple. Not sure what the purpose of that is for, but intersection seems to work without.

def intersection(self, *args):
    """
    Produce an array that contains every item shared between all the
    passed-in arrays.
    """
    # if type(self.obj[0]) is int:
        # a = self.obj
    # else:
        # a = tuple(self.obj[0])
    setobj = set(self.obj)
    for i, v in enumerate(args):
        setobj = setobj & set(args[i])
    return self._wrap(list(setobj))
@Andy671
Copy link

Andy671 commented Apr 2, 2024

confirm this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants