News for hackers. Stuff that matters.
Re:Why Python is Important for You by gte910h on Saturday February 11, 2012 @07:45PM (#3580657)
You should try inverting that code with guard statements:

    def frob(someargs):
        if something <= 2: return

        # do some processing
        if that != "CONNECT": return
        
        if verdict not in blessedsolutions: return
                    
        print "Happy birthday!"
Code Complete 2 suggests this for many types of logic when overly deep nesting bites you.

There are no comments on this comment yet.