python – python3 TypeError: function object is not iterable

python – python3 TypeError: function object is not iterable

What the traceback error is pointing out is the misuse of for statement:

for i in Updt():

for in python 3 is as follows: Python’s for statement iterates over the items of any sequence (a list or a string), in the order that they appear in the sequence. (source: python 3.3 documentation, section 4: More control structures Python 3

Since a function is neither a list nor a string, you cant use the format:

for [variable] in [function]():

As far as what needs to be fixed, it depends on what those two functions are supposed to accomplish individually.

So lets break down the error.

TypeError: function object is not iterable

This error points to the line

for i in Update()

You always want the thing after in to be an iterable, meaning something that you can loop through. Because you dont actually return anything in your Update() function. Python tries to loop through an object of type NoneType which is not allowed.

python – python3 TypeError: function object is not iterable

Leave a Reply

Your email address will not be published. Required fields are marked *