[Python-Dev] PEP 288: Generator Attributes (original) (raw)
Raymond Hettinger Raymond Hettinger" <python@rcn.com
Fri, 22 Nov 2002 03:46:08 -0500
- Previous message: [Python-Dev] Expect in python
- Next message: [Python-Dev] PEP 288: Generator Attributes
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
PEP 288 has been updated and undeferred. Comments are solicited.
The old proposal for generator parameter passing with g.next(val) has been replaced with simply using attributes in about the same way as classes:
def outputCaps(logfile): while True: line = self.data logfile.write(line.upper) yield None outputCaps.data = "" # optional attribute initialization
g = outputCaps(open('logfil.txt','w')) for line in open('myfile.txt'): g.data = line g.next()
The separate proposed for generator exceptions is unmodified from before.
- Previous message: [Python-Dev] Expect in python
- Next message: [Python-Dev] PEP 288: Generator Attributes
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]