mathialo / bython

Python with braces. Because python is awesome, but whitespace is awful.
MIT License
2.04k stars 49 forks source link

Multiline lambdas? #26

Open lukefisklennon opened 5 years ago

lukefisklennon commented 5 years ago

Hi there!

One of my main gripes about Python is not being able to write multiline lambdas. I had an idea to create a Python preprocessor that allows braces (and found this before making it myself) to allow multiline lambdas, but also to generally improve readability.

I'm just wondering if Bython supports multiline lambdas, or plans to in the future.

Thanks so much!

abalter commented 5 years ago

I second this. I think we are really talking about anonymous functions, which is a big limitation of python.

lukefisklennon commented 5 years ago

@abalter Thanks for the clarification, that's what I meant.

abiramen commented 1 year ago

so true @lukefisklennon

evan-a-w commented 1 year ago

I agree!

thehappycheese commented 6 months ago
  1. multiline lambdas ❤️
  2. maybe, one day, a slightly less complicated parser in the language internals? 🤷

The only reasonable arguments for this project to exist.

JacopoMadaluni commented 4 weeks ago

I second this. Anonymous functions are the most annoying aspect of the default python parser If you could do

dict = {
    "fn": lambda x, y { 
        # multi
        # line 
        # fn
    }
}

It would be absolutely glorious.

If enough people second this I could give it a go myself. I'd probably parse the function and transpile it into an actual declaration, as python just does not support multi line lambdas.

dict = {
    "fn": lambda x, y { 
        # multi
        # line 
        # fn
    }
}

------------

def _anon_uuid(x, y):
        # multi
        # line 
        # fn

dict = {
    "fn": _anon_uuid
}