Hacker News new | ask | show | jobs
by ryl00 2670 days ago
But doesn't the whitespace issue gimp Python's lambda syntax? AFAIK you're limited to one expression or function call, to get around the fact that you can't just inline a completely new function (with its associated control flow structure).

And what about one-liners, a la Perl? Stack Overflow answers seem to imply either embedding newlines in your string, or using semi-colons (as a Python newbie... you can use semi-colons?!)

1 comments

> AFAIK you're limited to one expression or function call, to get around the fact that you can't just inline a completely new function (with its associated control flow structure)

On the other hand, if your function needs a flow structure that's more complicated than a single line, should you really be inlining it?

And I think any such use case that you really want to inline can probably be accomplished with list comprehensions