r
is the variable, which is a pattern.
As you can see in the second answer, it is assigned to:
r = re.compile(".*cat")
The reason there is not parenthesis is because it's using the filter
function which automatically adds the parenthesis and adds the element in the list to filter.
As mentioned in the docs:
Construct an iterator from those elements of iterable for which function returns true. iterable may be either a sequence, a container which supports iteration, or an iterator. If function is None, the identity function is assumed, that is, all elements of iterable that are false are removed.
Note that filter(function, iterable) is equivalent to the generator expression (item for item in iterable if function(item)) if function is not None and (item for item in iterable if item) if function is None.
As you can see, it is the same as a generator with having parenthesis. The filter
function doesn't need parenthesis, that's the specialty of it.