[Python-ideas] data structures should have an .any() method
g.brandl at gmx.net
Sun Sep 6 10:18:53 CEST 2009
Greg Ewing schrieb:
> 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.
But if it's a sequence, you can simply do s, can't you?
Thus spake the Lord: Thou shalt indent with four spaces. No more, no less.
Four shall be the number of spaces thou shalt indent, and the number of thy
indenting shall be four. Eight shalt thou not indent, nor either indent thou
two, excepting that thou then proceed to four. Tabs are right out.
More information about the Python-ideas