Re:Python idiom for taking the single item from a list
by teilo on Monday September 27, 2010 @06:37PM
(#1733779)
That sounds logical enough, except for two things:
First: You are often working with someone-else's library which for various reasons you cannot change.
Second: It is not uncommon to use a standard method that may well be able to return multiple items, but in your use case it should only return one. Case in point: a database call that returns the result of a query.
First: You are often working with someone-else's library which for various reasons you cannot change.
Second: It is not uncommon to use a standard method that may well be able to return multiple items, but in your use case it should only return one. Case in point: a database call that returns the result of a query.