(domain)
return matches + ['.' + d for d in matches]
Potential domain matches for a cookie

    >>> potential_domain_matches('www.example.com')
    ['www.example.com', 'example.com', '.www.example.com', '.example.com']
Potential domain matches for a cookie
Potential domain matches for a cookie
def potential_domain_matches(domain):
    """Potential domain matches for a cookie

    >>> potential_domain_matches('www.example.com')
    ['www.example.com', 'example.com', '.www.example.com', '.example.com']

    """
    matches = [domain]
    try:
        start = domain.index('.') + 1
        end = domain.rindex('.')
        while start < end:
            matches.append(domain[start:])
            start = domain.index('.', start) + 1
    except ValueError:
        pass
    return matches + ['.' + d for d in matches]
def potential_domain_matches ( domain ) : matches = [ domain ] try : start = domain . index ( '.' ) + 1 end = domain . rindex ( '.' ) while start < end : matches . append ( domain [ start : ] ) start = domain . index ( '.' , start ) + 1 except ValueError : pass return matches + [ '.' + d for d in matches ]