Created
February 29, 2020 23:55
-
-
Save renpytom/3df4feb702e8c2a45486f6e36c9fd348 to your computer and use it in GitHub Desktop.
This file contains 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
init python: | |
class ConditionSub(object): | |
def __init__(self, *args): | |
self.items = [ (cond, value) for cond, value in zip(args[::2], args[1::2]) ] | |
def __unicode__(self): | |
for cond, value in self.items: | |
if eval(cond): | |
return self.value | |
default is_cat = True | |
define pet = ConditionSub("is_cat", "cat", "True", "dog") | |
label start: | |
"I have a [pet]." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment