31 Oct
2017
31 Oct
'17
3:52 p.m.
On Tue, Oct 31, 2017 at 10:42:23AM -0200, Joao S. O. Bueno wrote:
When I need something like this, I usually rop a line on the module namespace that goes like:
first = lambda x: next(iter(x))
That doesn't meet the requirement that x has ONLY one item. And using lambda like that is bad style. This would be better: def first(x): return next(iter(x)) and now first has a proper __name__. -- Steve