sum(fib() | where(lambda x: x % 2 == 0) | take_while(lambda x: x < 4000000))
I know in Lisp languages you can extend the syntax easily, but I was wondering if there are any needs for that in Python.[0] https://pypi.org/project/pipe/
There is a PEP for this[1] but it is currently deferred.
import pandas as pd
my_df = (
pd.Dataframe()
.join(<...>)
.query(<...>)
.sort_values(<...>)
)I also use plotly like so:
my_plot = (
px.line(<...>)
.update_xaxes(<...>)
.update_layout(<...)
)Not exactly function chaining, but I guess it has a similar effect.
I'm happy with Python's syntax nowadays and much prefer seeing improvements on library / environment related things.
It's interesting, I never cared about that until I did "Crafting Interpreters" and realized how separating those two actions helps clarify scopes.
Being realistic I know it's too large of a breaking change and will never land in the language but I can dream right?