News for hackers. Stuff that matters.
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.

Re:Python idiom for taking the single item from a list by baddox on Monday September 27, 2010 @08:14PM (#1734076)
Django's ORM, the only Python one I've experience with, provides get() for those cases.