Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The big one I want to see, because it's one of my biggest frustrations with Python, is to finally make lambdas work like every other contemporary language instead of being inexplicably limited to a single expression simply because Guido couldn't come up with a syntax that agreed with him.

There's so many cases (arguably including the problem this PEP was designed to solve!) where having a real inline closure is just far more readable than having to arbitrarily break every single thing that happens to need 2+ expressions out into named blocks out of sequence.

Other things in Python are either simply a result of the language's age and history, or have real technical pros and cons, but that one irks me because it's an artificial limitation chosen for no reason except aesthetics.



Nononono

God please NO!

I would KILL not to make that happen. So many devs abuse those in every language that has that. Even lambas get sometimes abused in Python (and I have a few examples in our codebase unfortunately). Expanding lambdas' scope is the LAST thing I want in Python, this would just lead to worst codebases, with nearly 0 benefit.

If you want to do something that needs 2 expressions, just create a goddamn function and name it for god's sake.

Sorry but I had to say it, I think the lambda limitations is one of my favorite feature in Python.


It's useful to be able to give names to things and it's also useful to not be able to give names to things.

It could and could also not be useful to give names to all the subexpressions in the following

w = a(b(c(x,y),z))

You could impose a limitation on how many function can be in a single expression, forcing you to give names. That's analogous to your favorite feature, no?


I read a long time ago and was convinced that no nice lambdas was one of the biggest problems in python, but that poster argued convincingly that it's an unavoidable consequence of the meaningful whitespace. Are you proposing a special syntax for multiple statements on one line for this?




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: