1
alert
4y

first() function in python...

Because it does not exist
Why have a any() that returns True if any of the items in iteratable are True
But what if I need to get the item itself...

In C it's as easy to write as the any func The performance will be the same

Comments
  • 0
    @momad next requires an iterator and doesn't skip non true values if I understood you correctly
  • 0
    Seems like it would be pretty easy to implement with firstN with a generator.
  • 0
    @SortOfTested and it is
    It's just sad it's not built-in z when any() is
  • 0
    @alert
    Contrib! Get some open source points.
  • 0
    @SortOfTested and get some free swag
    But really there is nothing I can do, it's an old topic and been around for quite a while
  • 0
    I would think a certain amount of easy implementations are important to keep around a steady pool of introductory or junior contributors to pull from in the future.
Add Comment