Skip to content

Instantly share code, notes, and snippets.

@inesp
Last active October 20, 2019 18:12
Show Gist options
  • Save inesp/b67ec7347be4246678573aa21b1901fb to your computer and use it in GitHub Desktop.
Save inesp/b67ec7347be4246678573aa21b1901fb to your computer and use it in GitHub Desktop.
class PrimaryTitleFinder:
def get_title(object_):
return object_.name if isinstance(object_, Person) else object_.title
person = Person(name="Artemisia Lomi", ...)
TitleFinder.get_title(person) # => returns "Artemisia Lomi"
issue = Issue(title="Find famous painters", assignee=...)
TitleFinder.get_title(issue) # => returns "Find famous painters"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment