The Artima Developer Community
Sponsored Link

Python Buzz Forum
Cleanest Python find-in-list function?

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Ryan Tomayko

Posts: 408
Nickname: rtomayko
Registered: Nov, 2004

Ryan Tomayko is an instance of a human being...
Cleanest Python find-in-list function? Posted: Nov 22, 2004 9:51 PM
Reply to this message Reply

This post originated from an RSS feed registered with Python Buzz by Ryan Tomayko.
Original Post: Cleanest Python find-in-list function?
Feed Title: Ryan Tomayko (weblog/python)
Feed URL: http://tomayko.com/feed/
Feed Description: Entries classified under Python.
Latest Python Buzz Posts
Latest Python Buzz Posts by Ryan Tomayko
Latest Posts From Ryan Tomayko (weblog/python)

Advertisement

I'm trying to find a Python built-in that will return the first item i in a sequence that given a function f returns i when f(i) == True. I need this about every 300 lines of code or so (that's actually quite a bit of code in Python). The general use-case is running through a list looking for an item matching some criteria and then returning it. This is more commonly dictionary-land (i.e. the items should be stored in a dict keyed by the criteria instead of a list) but that's not always practical/needed.

Read: Cleanest Python find-in-list function?

Topic: SqWebMail Previous Topic   Next Topic Topic: What's up with Syncato

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use