Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Re: Retrieving an object from a set

Reply
Thread Tools

Re: Retrieving an object from a set

 
 
Ian Kelly
Guest
Posts: n/a
 
      01-26-2013
On Fri, Jan 25, 2013 at 4:45 PM, MRAB <(E-Mail Removed)> wrote:
> You could first limit the search to only those which it could be:
>
> S & set([y])
>
> A search would be:
>
>>>> f = [m for m in S & set([y]) if m is y][0]
>>>> f is y

> True


But in practice he won't have y, only x. So that would have to be:

>>> f = [m for m in S & set([x]) if m is x][0]
>>> f is y

False

And it turns out that my earlier "intersection" suggestion fails for
the same reason.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Retrieving an object from a set Arnaud Delobelle Python 1 01-26-2013 06:25 AM
Re: Retrieving an object from a set MRAB Python 0 01-25-2013 11:45 PM
Re: Retrieving an object from a set Ethan Furman Python 0 01-25-2013 11:38 PM
Re: Retrieving an object from a set Ian Kelly Python 0 01-25-2013 11:37 PM
Re: Retrieving an object from a set Ian Kelly Python 0 01-25-2013 11:30 PM



Advertisments