Skip to content

Instantly share code, notes, and snippets.

@celine-m-s
Last active May 16, 2018 12:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save celine-m-s/072c657f8d15f5abf23084face622c0a to your computer and use it in GitHub Desktop.
Save celine-m-s/072c657f8d15f5abf23084face622c0a to your computer and use it in GitHub Desktop.
Python versus Ruby

Ruby

base_class.metadata.sorted_tables
  .each_value
  .select do |value|
    models.any? { |model| value.description.include?(model.__tablename__) }
  end

Python

tables = [
    base_class.metadata.sorted_tables[i] 
    for i, obj in enumerate(base_class.metadata.sorted_tables) 
    for model in models
    if model.__tablename__ in obj.description
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment