As an example of the elegant code you can look at the returns <https://returns.readthedocs.io/en/latest/> package. Quite often in Leo None is used either as a return value from a function or as an argument to the function. Just look at the examples in the *returns* documentaion how using some other way to represent missing value simplifies and beautifies the code.
if user is not None: balance = user.get_balance() if balance is not None: balance_credit = balance.credit_amount() if balance_credit is not None and balance_credit > 0: can_buy_stuff = True else: can_buy_stuff = False # or using returns ... def get_balance(user): return user.get_balance() def credit_amount(balance): return balance.credit_amount() def is_positive(x): return x > 0 pipeline = pipe( get_balance, credit_amount, is_positive, ) can_buy_stuff = Maybe.from_value(user).map(pipeline) Look how beutifully and how easy it is to compose pure functions in the pipeline and then mapping it to the Maybe value. And how nested and unreadable code becomes when you have to do with possible None values. Leo has many places where this pattern can be applied. How easy it would be to test this function. There is no place for bugs to hide. Vitalije -- You received this message because you are subscribed to the Google Groups "leo-editor" group. To unsubscribe from this group and stop receiving emails from it, send an email to leo-editor+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/leo-editor/2f882687-9610-4a59-8a17-237eb6b17f7a%40googlegroups.com.