3 ms·
Sometimes it takes code like this: foo = ( spark .read .parquet(...) .filter(...) .withColumn(...) ) and turns it into foo = spark.
by mrtranscendence 5y ago
Sometimes it takes code like this:
foo = (
spark
.read
.parquet(...)
.filter(...)
.withColumn(...)
)
and turns it into
foo = spark.read.parquet(
...
).filter(
...
).withColumn(
...
)
which feels harder to parse for me. I also never quite got on board with the trailing commas.
- philote 5y agoPersonally I prefer my code to read more like a sentence instead of being split up into too many lines.
- ihaveajob 5y agoI guess the point of the parent applies when the parameter lists are long, thus breaking the sentence-like appearance of the chained calls.
- BeFlatXIII 5y agoThese examples remind me why Elixir's pipe operator is so beloved.
- jreese 5y agoActually, modern versions of black will retain the fluent style you prefer, though it will collapse up to the first method call on the first line within the parens, so you end up with something like: foo = ( spark.read.parquet(...) .filter(...) .withColumn(...) )