[Tutor] 2.7.3 generator objects

eryksun eryksun at gmail.com
Sun Sep 2 09:34:21 CEST 2012

On Sun, Sep 2, 2012 at 3:09 AM, Ray Jones <crawlzone at gmail.com> wrote:
> But didn't I read somewhere that you can reset an iterator to go through
> the whole process again?

You could implement that ability in your own objects, but it's not
part of the protocol.

I forgot to mention generator expressions. This is an expression
(typically requiring parentheses) that evaluates to a generator
object. You can omit the parentheses if it's the only argument in a
call. For example:

    >>> g = (chr(i) for i in range(65, 69))
    >>> ", ".join(g)
    'A, B, C, D'

    >>> ", ".join(chr(i) for i in range(65, 69))
    'A, B, C, D'


More information about the Tutor mailing list