• @[email protected]
    link
    fedilink
    08 days ago

    The sample code for lazy imports looks wrong

    STRIPE = None
    
    def _stripe():
        global STRIPE
        if STRIPE is None:
            import stripe
    
            return stripe
        return STRIPE
    
    

    STRIPE is never changed. And two return statements in the same function?!

    Anyways can imagine how to do lazy imports without relying on the given code sample.