def _number_of_vars(line):
    """Count the number of variables in the line, excluding comments denoted by
 # and the first word which is expected to be the variable name"""

    ncommands = 0
    for word in line:
        if word[0] != '#':
            ncommands += 1
        else:
            break
    ncommands -= 1 # Ignore first word which must be the variable name
    if ncommands < 0:
        ncommands = 0 # If this is just a comment line, there's no variable name

    return ncommands