Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiline lambdas? #26

Open
lukefisklennon opened this issue Nov 16, 2018 · 6 comments
Open

Multiline lambdas? #26

lukefisklennon opened this issue Nov 16, 2018 · 6 comments

Comments

@lukefisklennon
Copy link

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
Copy link

abalter commented Dec 20, 2018

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

@lukefisklennon
Copy link
Author

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

@abiramen
Copy link

so true @lukefisklennon

@evan-a-w
Copy link

I agree!

@thehappycheese
Copy link

  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
Copy link

JacopoMadaluni commented Sep 10, 2024

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
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants