News for hackers. Stuff that matters.
Re:Python idiom for taking the single item from a list by njharman on Monday September 27, 2010 @04:29PM (#1733267)
Lists use (not infrequently) logic like the following;

  If one element
    do this one element thing
  else
    do this more than one element thing
Re:Python idiom for taking the single item from a list by iron_ball on Monday September 27, 2010 @04:54PM (#1733373)
But in that case, either your code is evidently in a branch where the list will have one item -- as in your example -- in which case the context makes it clear. And if there's no context, such as in a nested function call, then at some point you should be passing that lone list item into a function which takes the item as an argument.