[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#711359: ITP: python-first -- simple function that returns the first true value from an iterable



On Thursday, June 06, 2013 09:01:05 PM Andrey Rahmatullin wrote:
> On Thu, Jun 06, 2013 at 04:31:43PM +0200, Julien Danjou wrote:
> > Package: wnpp
> > Severity: wishlist
> > Owner: Julien Danjou <acid@debian.org>
> > 
> > * Package name    : python-first
> > 
> >   Version         : 2.0.0
> >   Upstream Author : Hynek Schlawack
> > 
> > * URL             : https://pypi.python.org/pypi/first
> > * License         : MIT
> > 
> >   Programming Lang: Python
> >   Description     : simple function that returns the first true value from
> >   an iterable> 
> > A MIT licensed Python package with a simple function that returns the
> > first true value from an iterable, or None if there is none. If you need
> > more power, you can also supply a key function that is used to judge the
> > truth value of the element or a default value if None doesn’t fit your
> > use case.
> 
> Is that a dependency for something else?
> The software contains 10 lines that can be considered code.
I haven't looked at the code but you can do this in one line with itertools 
and a combination of keepwhile and dropwhile.


Thomas Koch, http://www.koch.ro

Attachment: signature.asc
Description: This is a digitally signed message part.


Reply to: