Functional Programming in Python
&gt; But, having null checks here and there makes your code unreadable.<p><pre><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 &gt; 0:                                                                                                                                                                                                                                                                                          
                 can_buy_stuff = True                                                                                                                                                                                                                                                                                                                       
    else:                                                                                                                                                                                                                                                                                                                                                   
        can_buy_stuff = False                                                                                                                                                                                                                                                                                                                               
                                                                                                                                                                                                                                                                                                                                                            </code></pre>
Actually I think that&#x27;s very readable<p><pre><code>    user: Optional[User]                                                                                                                                                                                                                                                                                                                                    
                                                                                                                                                                                                                                                                                                                                                            
    can_buy_stuff: Maybe[bool] = Maybe.from_value(user).map(  # type hint is not required                                                                                                                                                                                                                                                                   
        lambda real_user: real_user.get_balance(),                                                                                                                                                                                                                                                                                                          
    ).map(                                                                                                                                                                                                                                                                                                                                                  
        lambda balance: balance.credit_amount(),                                                                                                                                                                                                                                                                                                            
    ).map(                                                                                                                                                                                                                                                                                                                                                  
        lambda balance_credit: balance_credit &gt; 0,                                                                                                                                                                                                                                                                                                          
    )                                                                                                                                                                                                                                                                                                                                                       
                                                                                                                                                                                                                                                                                                                                                            
    Much better, isn&#x27;t it?                                                                                                                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                                                                                                                                            </code></pre>
No?!? That&#x27;s much worse.