((p, v) for p, v in properties if v is not None)
This is a generator expression. It produces a generator object which emits a pair (p,v)
from the list properties
each time it is polled, skipping those pairs where v is None, until it runs out of properties. That is, it emits each of the property, value pairs for which some value is set. "Each time it is polled" just means "each time someone asks for the next()
object"
for prop, value in some_collection:
This repeatedly asks some_collection
for its next object, which had better be a pair. The elements of that pair are assigned to the values prop
and value
respectively and the body of the loop is executed.
Putting them together, you can see that we are looping over the non-null properties and taking some action with them (we don't know what action, since we don't have the loop body)
I would suggest you start by looking into list comprehensions and dict comprehensions, and then proceed to understand generators, since list and dict comps are conceptually simpler.