Why doesn't the next function work on the Iterator object without prior assignment? - python : In python 3.7 if I have:

    >>> d1 = {2:5, 6:4, 7:8}
    >>> d2 = {50:31, 51:32, 52: 36}

and applying next function:

    >>> next(zip(d1, d2))
    (2, 50)
    >>> next(zip(d1, d2))
    (2, 50)
    >>> next(zip(d1, d2))
    (2, 50)
    .......

Though If I do an assignment

    g = zip(d1, d2)

and applying next function it does give the correct results:

    >>> next(g)
    (2, 50)
    >>> next(g)
    (6, 51)
    >>> next(g)
    (7, 52)

I want to know why the next function does not work on a generator object without an assignment to a variable.

Thanks

 
