[Chicago] Can this be done with a yield statement and generator object?

Lewit, Douglas d-lewit at neiu.edu
Tue Nov 10 03:10:12 EST 2015


Hey guys,

I'm attaching a simple class that I created in Python.... Python 3 to be
specific, but I think it should work in Python 2 as well, maybe.  Anyhow,
is there a way to implement the same concept using a *yield statement* in a
function to create a generator object?  Just wondering.  Let me know,
thanks!

Best,

Douglas Lewit

P.S.  Obviously if you use a generator object to do this then the generator
object would never produce the StopIteration error.  But I'm kind of
confused about how to create and define a generator object that would
produce this cyclical behavior in an array or list.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/chicago/attachments/20151110/b012ba59/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Circular_List_in_Python.png
Type: image/png
Size: 277517 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/chicago/attachments/20151110/b012ba59/attachment-0001.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: CircularList.py
Type: text/x-python
Size: 373 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/chicago/attachments/20151110/b012ba59/attachment-0001.py>


More information about the Chicago mailing list