Skip to content

Instantly share code, notes, and snippets.

@narma
Last active January 4, 2023 15:09
Show Gist options
  • Save narma/858372 to your computer and use it in GitHub Desktop.
Save narma/858372 to your computer and use it in GitHub Desktop.
Why ruby is better than python
", ".join(["%s: %s" % (k,v) for k,v in filter(lambda k,v: v, some_hash.items())])
some_hash.select { |k,v| v and !v.zero? }.collect { |k,v| "#{k}: #{v}" }.join ", "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment