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

  • SEARCH
  • Home
  • 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 417029
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T18:32:22+00:00 2026-05-12T18:32:22+00:00

I have a list. It contains x lists, each with y elements. I want

  • 0

I have a list. It contains x lists, each with y elements.
I want to pair each element with all the other elements, just once, (a,b = b,a)

EDIT: this has been criticized as being too vague.So I’ll describe the history.
My function produces random equations and using genetic techniques, mutates and crossbreeds them, selecting for fitness.
After a number of iterations, it returns a list of 12 objects, sorted by fitness of their ‘equation’ attribute.
Using the ‘parallel python’ module to run this function 8 times, a list containing 8 lists of 12 objects (each with an equation attribute) each is returned.
Now, within each list, the 12 objects have already been cross-bread with each other.
I want to cross-breed each object in a list with all the other objects in all the other lists, but not with the objects within it’s own list with which it has already been cross-bread. (whew!)

  • 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-05-12T18:32:22+00:00Added an answer on May 12, 2026 at 6:32 pm

    itertools.product is your friend.

    about removing the duplicates, try with a set of sets.

    Now it’s a little bit clearer what you want:

    import itertools
    
    def recombinate(families):
        "families is the list of 8 elements, each one with 12 individuals"
        for fi, fj in itertools.combinations(families, 2):
            for pair in itertools.product(fi, fj):
                yield pair
    

    basically, take all the 2-combinations of families (of those produced in parallel) and for each pair of families, yield all the pairs of elements.

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

Sidebar

Related Questions

In order to choose categories, I want to use dropdown lists. Each list contains
I have a asp:ListBox wrapped inside an asp:UpdatePanel. The list box contains all the
I have a rather large list of data that contains 5 properties per element.
I have a list containing 98 items. But each item contains 0, 1, 2,
I need to compare two lists where each list contains about 60,000 objects. what
I have an array that contains a list of vertices which I copy to
I have a class that contains a list of objects. What's the best way
I have a Request object which contains a list of Approvers. An approver has
I have a base class Node which contains a list of child nodes. Node
Lets say I have an entity Foo, and it contains a list of another

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.