Skip to content

Instantly share code, notes, and snippets.

@frankandrobot
Created July 25, 2018 02:22
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 frankandrobot/8161e873651166dc6e2af1b675c9cebb to your computer and use it in GitHub Desktop.
Save frankandrobot/8161e873651166dc6e2af1b675c9cebb to your computer and use it in GitHub Desktop.
simple brain teaser
def is_visible(object_value, current_visibility, desired_visibility):
specified = object_value['visibility']
if current_visibility == 'hide':
if desired_visibility == 'show':
return specified == desired_visibility
else:
return True
# current_visibility is "show"...
if desired_visibility == 'show':
return specified == desired_visibility or specified is None
else:
return True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment