[Solved] Python TypeError: 'generator' object is not callable ...
coderedirect.com › questions › 622390Oct 28, 2021 · You don't need to call your generator, remove the () brackets. You are probably confused by the fact that you use the same name for the variable inside the function as the name of the generator; the following will work too: A parameter passed to the somefun function is then bound to the local lengen variable instead of lengths, to make it clear that that local variable is not the same thing as the lengths () function you defined elsewhere.