Optimization - avoid temporary list objects, unnecessary function call #1481
Well yes, I have two reservations for this PR. The first is that some of them are unnecessary, and they don't optimize anything: generator expressions are slower than list comprehensions, and memory savings in most places where code is changed are not important (slowdown is not important either though). It is not like anyone has 100000 spider contracts or 10000-segment spider module names.
Second is that the PR makes changes to untested parts of code (coverage reports shows this). For example, if ContractsManager would have required a list (like DeferredList did in old Twisted versions) we may not notice it.
That said, I agree with some of the cleanups; they are not optimizations, but they remove unnecessary braces in source code. So +1 to merge it if either changes to untested code are removed or new tests are added.