Stylistic choice of validation functions
Hey all! Got a question. I’m working on a validation script for work verifying some supplied input against required values. I’m wondering, stylistically, if there’s a “preferred way” to write these functions. 

An example function… 

    

    Def name_max_length(name): 
        if 1 &lt; len(name) &lt;= 128:
             return None
        else: 
             raise     ValidationError(“Names length fell outside of max range.”) 



Apologies if Reddit mobile mangled that code but it’s short enough that I think everyone can still grok it. 

If you were working on a project would you want to see the above? Or would you rather read a single if statement, without an else, checking to see if it fell outside of the valid range and if so raise the exception. 

I thought PEP-8 had a stylistic recommendation about positive vs negative checking for if statements but I gave it a quick scan and didn’t see anything. I’m going to be writing a lot of these, so I’d like to get a solid stylistic choice under me. 

I’m also curious, would you rather see these ranges hard coded in the if statement, or see two local variables (min/max) and have “if”compare against those?