Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8840479
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T10:28:27+00:00 2026-06-14T10:28:27+00:00

I am using Python 2.5.4. From here: Python -Intersection of multiple lists? I have

  • 0

I am using Python 2.5.4. From here: Python -Intersection of multiple lists?

I have this:

def intersect(*d):
    sets = iter(map(set, d))
    result = sets.next()
    for s in sets:
        result = result.intersection(s)
    return result

The following works as expected:

intersect([1,2,3,4], [2,3,4], [3,4,5,6,7])

But, I have something that looks more like the following:

d=[ [1,2,3,4], [2,3,4], [3,4,5,6,7] ]

If I call it like:

intersect(d)

I get:

TypeError: list objects are unhashable

How do I transform the d above into something intersect() can take?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T10:28:28+00:00Added an answer on June 14, 2026 at 10:28 am

    You need to pass the contents of your list as separate parameters:

    intersect(*d)
    

    What happens otherwise is that the whole list is being used as one set instead. The *d syntax indicates to Python that you want to use d as a sequence of parameters to the function, instead using the whole d list as just one parameter.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been trying to manupulate registry key from python using the win32api module
I have the following script for sending mails using python import smtplib from email.mime.multipart
I have some code: ... reader.loop(0, callback) ... (from here http://breakingcode.wordpress.com/2010/04/02/using-impacketpcapy-with-python-2-6-on-windows/ ) How this
I'm trying to learn how to do XPath queries from Python using this sample
I have a super simple python script as defined here import multiprocessing from multiprocessing
I have a Python script adapted from Downloading MMS emails sent to Gmail using
I have installed PyOpenGL from here for 64-bit Python 3.x and Windows 7. I
I'm trying to call a java program from python using command line. The code
I am using Python and Requests to request data from Twitter's streaming API .
I want to extract information from Twitter using Python. There is a page with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.