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 7577187
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T17:07:12+00:00 2026-05-30T17:07:12+00:00

I thought what I had was a common problem, but I could not find

  • 0

I thought what I had was a common problem, but I could not find any help either in Google nor in SO.

I have 2 lists that contain objects of class Marker. A Marker consists of variables name, position and type. I want to intersect the two lists, create tuples of markers of the same type and store them in a new list. Literally speaking, I want to do something like the following:

g_markerList = [ (marker1,marker2) for marker1 in marker1List and marker2 in marker2List if marker1.type == marker2.type ]

Apparently, this code does not work. Compiler does not ”know” variable marker2 following and, which ends the for clause.

Please help me to intersect these two lists and obtain a list of tuples of similar markers!

  • 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-30T17:07:14+00:00Added an answer on May 30, 2026 at 5:07 pm

    Change the and to for:

    g_markerList = [ (marker1,marker2) for marker1 in marker1List
                                       for marker2 in marker2List
                                       if marker1.type == marker2.type ]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

can anyone help, i have problem doing a sort, I thought i had it
I thought I had the assets pipeline figured out, but not any more. I
Yesterday i had a question in an interview which i thought i could find
I had thought I could enumerate the types using IMetaDataImport.EnumTypeDefs and for each of
I thought I had a pretty good handle on memory management for objective-c, but
I thought I had this figured out but it turns out I'm just deleting
Alright, I thought I had this whole setTimeout thing perfect but I seem to
I thought I had seen a bug report about this on the jQuery site,
This may seem like a programming 101 question and I had thought I knew
Generally, I had thought it was always better to store images in the filesystem

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.