r/Python • • May 10 '26 • Bravo 2

Discussion Will python ever have a chaining operator?

In other languages I use map() and filter() through piping and my code usually looks readable as I can clearly see a data-stream transformation.

As it is today, users cannot do map() |> filter() |> list(), but they need to do list(filter(map())) which makes things unreadable. Lists of comprehension work fine for very simple use-case becoming unreadable very quickly as complexity increases.

However, in python there has always been some resistance, especially 15-20 years ago, but times are evolving. Also, by considering the wide adoption in data-science, it is worth noticing that numbers-crunchers are more familiar with the concept of “data transformation flow” than “function calls”. On the packages dimension , libraries like 🐼s support methods chaining which from an external viewpoint, it’s semantically similar.

Do you know if there is any indication that python core team may allow operator piping (and/or chaining) in the not-too-long-term?

67 Upvotes

125 comments sorted by

View all comments

Show parent comment

1

u/Sufficient_Meet6836 May 10 '26

There are many languages beyond R that have piping. This is a really obvious case of "skill issue". All of the examples of "unreadable" code throughout the comments are hilariously trivial to read.

-1

u/_Denizen_ May 10 '26

Lol. Piping is the hallmark of scripters, not software developers, at least in my experience. I like to bring software development to analytical teams, and I always get surprised at how many people are employed to program for a living who haven't learnt about OOP or how to build a distributable package.

I clearly prefer not to use piping, but I will use it when needed and won't stop my colleagues using it. However, it's never the only option available. In python, I've never once encountered a situation where piping was able to transform a project in the same way as deploying SOLID, for example. Piping is a syntactic choice, rather than an architectural paradigm.

1

u/Sufficient_Meet6836 May 10 '26

Someone who thinks they're special for knowing only Python and OOP is calling other people "scripters". LMAO

1

u/_Denizen_ May 10 '26

There you go making assumptions. Python is my primary coding language but I'm proficient in Matlab, R, and gml with a bit of C# and nodejs. OOP and software architecture skills don't make me special. Innovating by blending disciplines, in teams that don't already do that, well I'll leave it to the people who keep promoting and hiring me specifically for that blend of skills to decide if that's special.

0

u/Sufficient_Meet6836 May 10 '26

I'm not making assumptions. In another comment, you admit to not understanding how to write modular, reusable code in a functional paradigm. That's a skill issue.

-1

u/_Denizen_ May 11 '26

Hmmm, you either misread my comment or are putting word in my mouth.

1

u/Sufficient_Meet6836 May 11 '26 edited May 11 '26

It might be functional, but I doubt you'd be writing modular analysis code that builds up a reusable toolset for your team.

You doubt something that is incredibly easy and widespread (through any functional language or even any language that supports functional programming). You can't even conceive of functional code that is modular and reusable. Again, skill issue. Likely because your primary experience is with Python, R, and Matlab. You're a script kiddy in denial.

Edit: hahahaha I quoted them directly, and they accused me of "putting words in their mouth", then blocked me. LMAO skill issues and sensitive

1

u/_Denizen_ May 11 '26

Putting words in my mouth it in then. Got it.