Last active
October 20, 2019 18:12
-
-
Save inesp/b67ec7347be4246678573aa21b1901fb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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