>You also need to post the code that raises the error, or no one else can
debug it.

sorry, I thought I had pasted that line in there, but I guess I missed
it. Here's the full code (after modifying it slightly based on your
post):

#! /usr/bin/env python

def circular_list(list):
    def __getitem__(self, i):
        return list.__getitem__(self, i % len(self))

items = circular_list(range(8))

for i in items:
    print i

[/end code]

[EMAIL PROTECTED] ~/tests/afx-view $ ./circular.py
Traceback (most recent call last):
  File "./circular.py", line 10, in ?
    for selected in items:
TypeError: iteration over non-sequence

if I just try to call:

print items[12]

I get this error:
[EMAIL PROTECTED] ~/tests/afx-view $ ./circular.py
Traceback (most recent call last):
  File "./circular.py", line 9, in ?
    print items[12]
TypeError: unsubscriptable object

I'm using python 2.3.5

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to