language analysis to enforce code standards

greg greg at cosc.canterbury.ac.nz
Fri Jul 10 22:25:11 EDT 2009


Aahz wrote:

> Much simpler and *way* more efficient with a set:
> 
> if len(set(s)) < N:
>     print "Must have at least %s different characters" % N

Or you could do a dictionary lookup on the words.
I can just see the error message:

   "Your comment must include at least one verb,
   one noun, one non-cliched adjective and one
   Monty Python reference."

-- 
Greg



More information about the Python-list mailing list