[visitor] Implement iterator.__next__()

The next() method was renamed to __next__() in python3.

authorRémi Cardona <remi.cardona@free.fr>
changeset7f4cbc65fb96
branchdefault
phasepublic
hiddenno
parent revision#c1924b7d9a7e [py3k] explicitly build a list around dict methods
child revision#5288095c9295 [py3k] Replace uses of 'unicode'
files modified by this revision
visitor.py
# HG changeset patch
# User Rémi Cardona <remi.cardona@free.fr>
# Date 1405545884 -7200
# Wed Jul 16 23:24:44 2014 +0200
# Node ID 7f4cbc65fb9677a206063bdae6eac53d4688fafc
# Parent c1924b7d9a7e5bc5b4e8a0ceb23058c80eae8d02
[visitor] Implement iterator.__next__()

The next() method was renamed to __next__() in python3.

diff --git a/visitor.py b/visitor.py
@@ -33,16 +33,18 @@
1          self._next = [(node, 0)]
2          if filter_func is None:
3              filter_func = no_filter
4          self._list = list_func(node, filter_func)
5 
6 -    def next(self):
7 +    def __next__(self):
8          try:
9              return self._list.pop(0)
10          except :
11              return None
12 
13 +    next = __next__
14 +
15  # Base Visitor ################################################################
16  class Visitor(object):
17 
18      def __init__(self, iterator_class, filter_func=None):
19          self._iter_class = iterator_class