summaryrefslogtreecommitdiff
path: root/astroid/node_classes.py
diff options
context:
space:
mode:
Diffstat (limited to 'astroid/node_classes.py')
-rw-r--r--astroid/node_classes.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/astroid/node_classes.py b/astroid/node_classes.py
index ebbcef09..b1344723 100644
--- a/astroid/node_classes.py
+++ b/astroid/node_classes.py
@@ -2576,13 +2576,13 @@ class Const(mixins.NoChildrenMixin, NodeNG, bases.Instance):
"""An iterator over the elements this node contains.
:returns: The contents of this node.
- :rtype: iterable(str)
+ :rtype: iterable(Const)
:raises TypeError: If this node does not represent something that is iterable.
"""
if isinstance(self.value, str):
- return self.value
- raise TypeError()
+ return [const_factory(elem) for elem in self.value]
+ raise TypeError("Cannot iterate over type {!r}".format(type(self.value)))
def pytype(self):
"""Get the name of the type that this node represents.