View Single Post
Old May 19th, 2006, 1:23 PM   #56
Arevos
Programming Guru
 
Arevos's Avatar
 
Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 5 Arevos is on a distinguished road
Also, I should add that if you're not dealing with a list, there's no need for a list comprehension:
return link['href']
List comprehensions are needed for the same reason you need for-loops; for applying the same operation to multiple elements. In this case, the list comprehension takes the "href" attribute from each element in the list. If you're only dealing with a single element, list comprehensions are not needed.
Arevos is offline   Reply With Quote