
Dec. 12, 2019
11:47 a.m.
take_one()? takeone()? take1()?
That could work. The docs can mention that for anything with ordering the result is guaranteed to be the *first* in the order. Do note that the main use case for the function is to consume only the first result of an iterable, generators in particular. In that context, *takeone()* sounds a lot like if any random result is fine. The docs can be simpler (less special cases) if it's called *first()* by just explaining that the result is *next(iter(it))* with provisions for non-yielding iterators and default return values. -- Juancarlo *Añez*