Ad
  • Default User Avatar

    If performance is a concern, it's still better to write the 'yield' expression. These are lazy gens and they're sometimes half as slow, but it's likely just splitting hairs unless you're working on exceptionally large sets of data.

  • Default User Avatar

    Actually, generally accepted best practice is to not use named lambdas. Lambdas should be 'throw away' expressions, not statements and def fn's will usually eek out performance over λ expressions but not by anything really noticeable unless you have some order of op stuff going on. If you really want to make this fn sing, use a generator, ala my fork.

  • Custom User Avatar

    using a lambda, an "anonymous function" to make a named function is sooOoOOoOOooOooOooOo smart and definitely not bad practices. Most linters will yell at you for this.