Throwing StopIteration in array extras to stop the iteration

Bjoern Hoehrmann derhoermi at gmx.net
Mon Mar 4 10:14:15 PST 2013


* Jeff Walden wrote:
>On 03/03/2013 06:49 PM, Rick Waldron wrote:
>> Is this +1 to findIndex? 
>
>Not that I much care between the two, just making sure another 
>reasonable name is considered, but I'm not sure why it wouldn't be named 
>"find" rather than "findIndex".  The index seems like the only bit you'd 
>reasonably be looking to find.  (Well, maybe existence, but I'd expect a 
>name like "contains" for that, or just indexOf !== -1.)

`find` finds the first element matching the supplied predicate in C#,
Groovy, Haskell, and Scala, and the first element that is equal to the
supplied value in C++, to mention a few examples. I think Python has a
`find` method on strings that returns the index, but that's not generic.
-- 
Björn Höhrmann · mailto:bjoern at hoehrmann.de · http://bjoern.hoehrmann.de
Am Badedeich 7 · Telefon: +49(0)160/4415681 · http://www.bjoernsworld.de
25899 Dagebüll · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/ 


More information about the es-discuss mailing list