Need to understand Python generator object

generator, generator-expression, python

Solution

The parenthesis can be omitted when used in function calls with only one argument, the generator expression syntax specifically allows for it.

The parentheses can be omitted on calls with only one argument. See section Calls for the detail.

Problem

In the following: ``` name = 'TODD' chars = set('AEIOU') for ii in range(-1, int(math.copysign(len(name) + 1, -1)), -1): if any((cc in chars) for cc in name[ii]): print 'Found' else: print 'Not Found' ``` I understand that what's inside any(...) is a generator object. What I don't understand is the lack of parentheses - if the parentheses belong to the any() function, shouldn't there be another set of parentheses around the generator expression? Thanks.

Original source