[Python-ideas] data structures should have an .any() method
greg.ewing at canterbury.ac.nz
Sun Sep 6 07:51:43 CEST 2009
Nick Coghlan wrote:
> That said, I'm -0 on the idea overall. If someone actually needs it, it
> isn't particularly hard for them to write their own getany() function.
There's a situation where the need to do this kind of
thing actually arises fairly frequently -- retrieving
things from a relational database. Often you're
expecting exactly one result from a query, but the
API always gives you a sequence, which you then have
to get the first item from. Doing that over and
over again gets rather tedious.
More information about the Python-ideas