Ticket #4037: 4037-interact_list_of_first_n.patch

File 4037-interact_list_of_first_n.patch, 1.1 KB (added by Alex Ghitza, 14 years ago)
  • sage/server/notebook/interact.py

    # HG changeset patch
    # User Alexandru Ghitza <aghitza@alum.mit.edu>
    # Date 1220329326 -36000
    # Node ID a5cf4f780f3f46fe78e90865d1d3f07c9de45a5c
    # Parent  d3af9775143a072f8bd0fd1babd7bb2777efa1d0
    trac #4037: trivial fix of list_of_first_n() in interact.py
    
    diff -r d3af9775143a -r a5cf4f780f3f sage/server/notebook/interact.py
    a b  
    25502550
    25512551    EXAMPLES:
    25522552        sage: sage.server.notebook.interact.list_of_first_n(Primes(), 10)
    2553         [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31]
     2553        [2, 3, 5, 7, 11, 13, 17, 19, 23, 29]
    25542554        sage: sage.server.notebook.interact.list_of_first_n((1..5), 10)
    25552555        [1, 2, 3, 4, 5]
    25562556        sage: sage.server.notebook.interact.list_of_first_n(QQ, 10)
    2557         [0, 1, -1, 1/2, -1/2, 2, -2, 1/3, -1/3, 3/2, -3/2]
     2557        [0, 1, -1, 1/2, -1/2, 2, -2, 1/3, -1/3, 3/2]
    25582558    """
    25592559    if not hasattr(v, 'next'):
    25602560        v = v.__iter__()
    25612561    w = []
    2562     while n >= 0:
     2562    while n > 0:
    25632563        try:
    25642564            w.append(v.next())
    25652565        except StopIteration: