It looks like this notation may not work in python 3.  It would be better to use the built-in as per @pelson original code. http://stackoverflow.com/questions/656155/why-did-python-2-6-add-a-global-next-function