--- /dev/null
+
+# Katie comments—
+
+# Ben used the phrase "play the hand you are dealt"
+# And I think this is a thing that you're missing in general
+# That when some things can't be different, you optimize them
+# You were born with awesome Jew hair, so make it awesome
+# And you were born a man
+# So get good at being a man
+# I became a mom, unexpectedly
+# So I tried to be a good mom, lean into the personality traits I have that made me more maternal
+# There are some instances in life where you should try to change the hand you are dealt
+# But I think hair (and gender, as you know) aren't those things, at least not usually
+# That's sometimes what bothers me about some trans people who don't pass well
+# Spencer could have been a good man
+# Or Ada could be an ugly, non-passing, masculine, male-interests woman
+# And he chose wrongly I think
+
+
+# in a nearby alternate future in which my analogue read different books in a differnt order
+# "Mark!"
+# "I don't got by that anymore" _As you know_
+# "Right." (he doesn't say sorry) "You're looking ... well ..."
+# (I know he meant it as an interjection, but I decide to interpret it as an adverb) "Thank you"
+# (Python ADTs)
+# a Python program should be the best Python program it could be
+# "This isn't about code, is it?"
+
+
+from typing import Callable, Optional, TypeVar, Union
+
+T = TypeVar('T')
+U = TypeVar('U')
+
+def option_map(arg: Optional[T], fn: Callable[[T], U]) -> Optional[U]:
+ if arg is not None:
+ return fn(arg)
+ else:
+ return None
+
+
+def bool_from_str1(s: str) -> Union[bool, ValueError]:
+ if s == "true":
+ return True
+ elif s == "false":
+ return False
+ else:
+ return ValueError
+
+def endpoint1(parameter: Optional[str]) -> Optional[bool]:
+ return option_map(parameter, bool_from_str1)
+
+
+
+def bool_from_str2(s):
+ if s == "true":
+ return True
+ elif s == "false":
+ return False
+ else:
+ raise ValueError
+
+def endpoint2(parameter):
+ if parameter is None:
+ return None
+ try:
+ return bool_from_str2(parameter)
+ except ValueError:
+ return None
+
+
+if __name__ == "__main__":
+ for endpoint in [endpoint1, endpoint2]:
+ for arg in ("true", "false", None, "rah"):
+ print(endpoint(arg))