summaryrefslogtreecommitdiff
path: root/astroid/protocols.py
diff options
context:
space:
mode:
authorClaudiu Popa <pcmanticore@gmail.com>2018-10-10 12:45:08 +0200
committerClaudiu Popa <pcmanticore@gmail.com>2018-10-10 12:45:08 +0200
commit5f04c394bdf52b07b276afb9d15de84ea34fea99 (patch)
treef6337e4c1c969494ad2e1c3323ee110dae9a70fd /astroid/protocols.py
parent94257385e9be4829dee38e5eee1ae283195ef18f (diff)
downloadastroid-git-5f04c394bdf52b07b276afb9d15de84ea34fea99.tar.gz
Use itertools.chain to join multiple generators together
Diffstat (limited to 'astroid/protocols.py')
-rw-r--r--astroid/protocols.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/astroid/protocols.py b/astroid/protocols.py
index 9258a368..a4c5ebcf 100644
--- a/astroid/protocols.py
+++ b/astroid/protocols.py
@@ -24,6 +24,8 @@ import collections
import operator as operator_mod
import sys
+import itertools
+
from astroid import Store
from astroid import arguments
from astroid import bases
@@ -174,9 +176,12 @@ def tl_infer_binary_op(self, opnode, operator, other, context, method):
not_implemented = nodes.Const(NotImplemented)
if isinstance(other, self.__class__) and operator == "+":
node = self.__class__(parent=opnode)
- elts = list(_filter_uninferable_nodes(self.elts, context))
- elts += list(_filter_uninferable_nodes(other.elts, context))
- node.elts = elts
+ node.elts = list(
+ itertools.chain(
+ _filter_uninferable_nodes(self.elts, context),
+ _filter_uninferable_nodes(other.elts, context),
+ )
+ )
yield node
elif isinstance(other, nodes.Const) and operator == "*":
if not isinstance(other.value, int):