
26 Oct
2009
26 Oct
'09
8:14 a.m.
John Arbash Meinel wrote:
res = heads(node1, node2) if len(res) == 1: # What is the 'obvious' way to get the node out?
I posit that there *isn't* an obvious way to get the single item out of a 1-entry frozenset.
for x in res: break list(res)[0] set(res).pop() iter(res).next() [x for x in res][0] x, = res # I didn't think of this one before recently
Are all answers, but none of them I would consider *obvious*.
And from my SQL-hacking experience:
x = min(s)
--Scott David Daniels Scott.Daniels@Acm.Org