
Changing Python lambda syntax at runtime - bthornbury
https://github.com/brthornbury/lambdazen/blob/master/HowItWorks.md
======
canjobear
I think you would be very pleased with and interested in macropy.

[https://github.com/lihaoyi/macropy](https://github.com/lihaoyi/macropy)

~~~
bthornbury
Yeah this is awesome. Using an AST is certainly much better than a regex for
rewriting the code, and it looks like this has the usability thought out.

Thanks for the link.

------
cutler
If you want Python without crippled lambdas just use Hy
([http://hylang.org](http://hylang.org)). Hy also liberates you from
signigicant whitespace.

~~~
bthornbury
Wow, that's a pretty neat project, going to take a deeper look

------
madmax96
Python users are essentially discovering what Lispers have known all along -
code is data. Once you fully comprehend that idea, you'll never be bothered by
Lisp's odd syntax because of the freedom in expressibility it gives you.

There are some fantastic Python hackers out there (some who know Lisp, others
who don't) and this is a logical step in the progression of any developer.
Eventually, they'll rediscover continuations too. But, as long as Python is
not homoiconic, it will never be as simple to express these ideas as it is in
Lisp.

~~~
fake-name
My understanding is that the python designers have intentionally made this
sort of functionality challenging to use, under the assumption (which I agree
with) that that sort of dynamic metaprogramming can result in code that can be
very challenging or even nearly impossible to follow or understand.

While lisp-y dynamism can let you do really cool things in very little code,
it also lets you do completely incomprehensible things in very little code.
Python has intentionally chosen to disallow the first to prevent the second.

~~~
wybiral
Agreed. Python has also pushed the mantra: "There should be one-- and
preferably only one --obvious way to do it".

Don't get me wrong, I love lisp, but it gives you the power to essentially
create your own domain-specific language. A power that comes with both
positive and negative side effects depending on the situation.

~~~
bthornbury
This is somewhat against the zen of python, but then again "Beautiful is
better than ugly." :)

~~~
wybiral
It's a neat concept. I also agree that the lambda statement in Python is ugly,
but actually using this in a Python project feels wrong.

Not that you couldn't call it a "transpiler" and consider it a new dialect of
Python... Hey, the Javascript community gets away with it, why not Python?

Also, while I can't think of a normal use case, it is possible that someone
intended to use (a, b, c) > (x, y, z) as a tuple comparison. ">>" or something
might be safer.

~~~
bthornbury
I agree in it's current state it's more of a novelty than something intended
for serious use. (Imagine debugging someone else's code with source rewriting
0_0) Especially with the discrepancy you pointed out with tuple comparison.

I think that it could get to a state where if the debugging was figured out,
and the abstractions/usability became nicer that it could be have some serious
use though. Mostly the intention with this was to get _something_ working,
that can be iterated on if it makes sense.

------
sbassi
I wonder why an article like this is not in a blog or medium or in same place
made for articles instead in a source code repo.

~~~
meddlepal
Why do you believe a blog is any more suitable than a GitHub repository? If
anything I probably prefer the GH repo since it's less likely to be click bait
designed to drive views to some guys blog for the purpose of self promotion
BS.

