News for hackers. Stuff that matters.
Re:Ask HN: What should be added to the syntax of Python and ... by pid-1 on Monday July 31, 2023 @06:27PM (#36949726)
I don't know the name of this idiom, but the following is valid Python:

import pandas as pd

my_df = (

    pd.Dataframe(<fetch_data>)

    .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.

Re:Ask HN: What should be added to the syntax of Python and ... by rowanG077 on Monday July 31, 2023 @06:45PM (#36949892)
It's called a fluent interface.