A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2002-November/030321.html below:

[Python-Dev] PEP 288: Generator Attributes

[Python-Dev] PEP 288: Generator Attributes [Python-Dev] PEP 288: Generator AttributesRaymond Hettinger Raymond Hettinger" <python@rcn.com
Fri, 22 Nov 2002 03:46:08 -0500
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.



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4