diff options
author | Mathieu Bridon <[email protected]> | 2018-07-05 15:17:39 +0200 |
---|---|---|
committer | Dylan Baker <[email protected]> | 2018-07-24 11:07:04 -0700 |
commit | 022d2a381d32d24aabe2c54704a5a5e2440a75e9 (patch) | |
tree | 587757745b212fef0f3c5ac9985b754963cb791e /src/compiler/nir/nir_algebraic.py | |
parent | 01da2feb0edd36abb161d96ccd6020c4b358da91 (diff) |
python: Better use iterators
In Python 2, iterators had a .next() method.
In Python 3, instead they have a .__next__() method, which is
automatically called by the next() builtin.
In addition, it is better to use the iter() builtin to create an
iterator, rather than calling its __iter__() method.
These were also introduced in Python 2.6, so using it makes the script
compatible with Python 2 and 3.
Signed-off-by: Mathieu Bridon <[email protected]>
Reviewed-by: Eric Engestrom <[email protected]>
Reviewed-by: Dylan Baker <[email protected]>
Diffstat (limited to 'src/compiler/nir/nir_algebraic.py')
-rw-r--r-- | src/compiler/nir/nir_algebraic.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/compiler/nir/nir_algebraic.py b/src/compiler/nir/nir_algebraic.py index 8c0b530f698..fda72d3c69e 100644 --- a/src/compiler/nir/nir_algebraic.py +++ b/src/compiler/nir/nir_algebraic.py @@ -56,7 +56,7 @@ class VarSet(object): def __getitem__(self, name): if name not in self.names: assert not self.immutable, "Unknown replacement variable: " + name - self.names[name] = self.ids.next() + self.names[name] = next(self.ids) return self.names[name] @@ -468,7 +468,7 @@ condition_list = ['true'] class SearchAndReplace(object): def __init__(self, transform): - self.id = _optimization_ids.next() + self.id = next(_optimization_ids) search = transform[0] replace = transform[1] |