KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have a generator defined like this: def lengths(x): for k, v in x.items(): yield v['time_length'] And it works, calling it with for i in lengths(x): print i produces: 3600 1200 3600 300 which are the correct numbers. However, when I call it like so: somefun(lengths(x)) where somefun() is defined as: def somefun(lengths): for length in lengths(): # <--- ERROR HERE if not is_blahblah(length): return False I get this error message: TypeError: 'generator' object is not callable What am I misunderstanding?
Tags (comma-separated)
Save Edits
Cancel