
Michael Smith writes:
This is just a small improvement, but worthwhile. It's intuitive IMO to be able to use similar filtering expressions to comprehensions at the top of a for loop.
Intuitive I guess, but in comprehensions it was "strictly from need" since comprehension syntax is an expression. There is no other way to explicitly filter in comprehensions. (One could write a generator function to do the filtering, but "explicit is better ...".)
Here's an example:
for path in Path("pyspark/jars")).glob("hadoop-*.jar") if not path.stem.startswith("hadoop-shaded-guava"):
"Bad MUA! Bad, bad MUA! You know you're not supposed to respect line length constraints when somebody's trying to make a point." My 63-year-old eyes struggle with 80-character lines, but in all fairness to those with better eyesight I'm not going to argue for Mom's 65[1]. But 106 (and that's assuming this is top-level "scripting" code) would get a "restructure and resubmit" from me. Footnotes: [1] The number of characters produced by my Mom's typewriter with 6.5" lines.