(n, generator=False)
return rv
r"""
    Return all divisors of n sorted from 1..n by default.
    If generator is True an unordered generator is returned.

    The number of divisors of n can be quite large if there are many
    prime factors (counting repeated factors). If only the number of
    factors is desired use divisor_count(n).

    Examples
    ========

    >>> from sympy import divisors, divisor_count
    >>> divisors(24)
    [1, 2, 3, 4, 6, 8, 12, 24]
    >>> divisor_count(24)
    8

    >>> list(divisors(120, generator=True))
    [1, 2, 4, 8, 3, 6, 12, 24, 5, 10, 20, 40, 15, 30, 60, 120]

    This is a slightly modified version of Tim Peters referenced at:
    http://stackoverflow.com/questions/1010381/python-factorization

    See Also
    ========

    primefactors, factorint, divisor_count
r"""
    Return all divisors of n sorted from 1..n by default.
    If generator is True an unordered generator is returned.
r Return all divisors of n sorted from 1 .. n by default . If generator is True an unordered generator is returned .
def divisors(n, generator=False):
    r"""
    Return all divisors of n sorted from 1..n by default.
    If generator is True an unordered generator is returned.

    The number of divisors of n can be quite large if there are many
    prime factors (counting repeated factors). If only the number of
    factors is desired use divisor_count(n).

    Examples
    ========

    >>> from sympy import divisors, divisor_count
    >>> divisors(24)
    [1, 2, 3, 4, 6, 8, 12, 24]
    >>> divisor_count(24)
    8

    >>> list(divisors(120, generator=True))
    [1, 2, 4, 8, 3, 6, 12, 24, 5, 10, 20, 40, 15, 30, 60, 120]

    This is a slightly modified version of Tim Peters referenced at:
    http://stackoverflow.com/questions/1010381/python-factorization

    See Also
    ========

    primefactors, factorint, divisor_count
    """

    n = int(abs(n))
    if isprime(n):
        return [1, n]
    if n == 1:
        return [1]
    if n == 0:
        return []
    rv = _divisors(n)
    if not generator:
        return sorted(rv)
    return rv
def divisors ( n , generator = False ) : n = int ( abs ( n ) ) if isprime ( n ) : return [ 1 , n ] if n == 1 : return [ 1 ] if n == 0 : return [ ] rv = _divisors ( n ) if not generator : return sorted ( rv ) return rv