Clarification on script

I have the following code which works, but I am curious about a behavior that I noticed, and in the spirit of expanding my understanding, I’m hoping that someone can explain why this is the way it is.

First a little context, I am using 7.9 so this is Jython 2.5, many of my scripts call multiple tags from within the same folder and this code facilitates building tagPath and value lists for calling readAll and writeAll. Thus the ‘tags’ variable in this code is the return value of a system.tag.browseTagsSimple call, and tagPaths holds many tags that may or may not be relevant to the script.

Here is the code snipit:

writePaths = [tag.fullPath for tag in tags if tag.name in ('Lot Number Returned','Step Lot Status', 'RGICN_HNS']

values = system.tag.readAll(tagPaths)

tagValues = {}
for t in range(len(tagPaths)):
     tagValues[tags[t].name] = values[t].value

writeValues = [tagValues[v] for v in 'Lot Number Returned','Step Lot Status', 'RGICN_HNS']

So my question is this, in the writePaths assignment removing the parenthesis around the tuple in the if statement results in a syntax error, however, the parenthesis are not required in the writeValues assignment. Is this a difference in the context of the ‘in’ statement due to one being used in an if statement and the other in a for statement or is it something else? Is it best practice to always use the parenthesis even though the comma is what makes the tuple?

For what it’s worth the same syntax error occurs if you write the comprehensions out as traditional for loops

Really, just looking for an explanation for what is going on here because I would expect the if statement to work with or without the parenthesis, but that is very possibly because I am missing something.