Um, I know that you can't make up names and expect them to magically do what you wish. My question was simply how to do the straight Pythonic function in a Django manner.
Thanks. ----- Original Message ----- From: "SmileyChris" <[EMAIL PROTECTED]> To: "Django users" <[email protected]> Sent: Sunday, July 08, 2007 7:24 PM Subject: Re: How can I achieve this intersection ? > > On Jul 9, 5:17 am, queezy <[EMAIL PROTECTED]> wrote: >> I would like to do this in Django, using two lists that are QuerySet >> lists: >> >> mylist=mylistWHOM.intersection(mylistWHAT) >> >> When I do it in the Pythonic way above, the django parser complains with: >> 'QuerySet' object has no attribute 'intersection' > > Of course it complains, QuerySets (or lists) don't have a function > called intersection. You can't just make up a name and expect it to do > what you want. > mylistWHOM.invite_them_to_my_party() won't work either. > > try something like: > > whom = set(mylistWHOM) > what = set(mylistWHAT) > mylist = whom & what # or whom.intersection(what), same thing. > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---

