←back to thread

2024 points randlet | 3 comments | | HN request time: 0.747s | source
Show context
theandrewbailey ◴[] No.17516370[source]
Python was my first programming language, ~15 years ago. The bracket- and semicolon-free syntax is beautiful and approachable to this day. Python is my go-to for writing data format conversion scripts. I wrote a random sentence generator in Python 10 years ago that gave me and my friends hours of entertainment.

Thanks, Guido, for the good times!

replies(1): >>17517645 #
fit2rule ◴[] No.17517645[source]
I can never get into Python and end up with as much passion as you. For me, its a very powerful and useful language - no doubt about it.

But the aesthetics of a whitespace language just don't jive with my 30+ years of experience writing code. No matter how many times I try over the past few decades, I just can't get passionate about writing Python code. I know its power, and I totally grok its value to our industry - but for me, Lua is just far more elegant, even if it doesn't ship with all of Pythons' goosebridles. Lua is my go-to scripting language; I only ever use Python if I have to - i.e. its enforced on me by others.

I really do try to get over this personal handicap, often enough, but the moment I have to start thinking about indentation I just lose all the passion and it starts feeling like a drag. What a dilemma, because I know it has been used for many, many great things .. I just wish I could get over my aversion to white-space'ing things all the time. I've tried editor after editor (well, expect the Python-specific things), but it just doesn't click.

Ah well.

replies(6): >>17517931 #>>17519165 #>>17519828 #>>17521140 #>>17521516 #>>17535913 #
enriquto ◴[] No.17521516[source]
> but for me, Lua is just far more elegant,

It's curious... Lua is my favorite language due to its elegance, but I would love it even more if it used significant indentation (using tabs, of course) instead of "end" blocks.

replies(2): >>17521701 #>>17523706 #
sebcat ◴[] No.17521701[source]
OTOH, I would love Python even more if I could do:

    x = function(x) return x*x end
and not use those awful Python lambdas...

Not that it really matters though, bridges still get built.

replies(3): >>17522056 #>>17522565 #>>17524098 #
1. aldanor ◴[] No.17522056[source]
Your example is already doable without lambdas:

    def f(x): return x * x
replies(1): >>17522270 #
2. sebcat ◴[] No.17522270[source]
To clarify: the point I was trying to make was that the explicit 'end' in Lua allows for closures that are more nice (subjective) than Python lambdas. Something both JS and Lua got right, but with which Python ended up with a much more limited syntax.
replies(1): >>17523589 #
3. klibertp ◴[] No.17523589[source]
The lambda syntax is not what makes it less nice - it's the fact that they are limited to a single expression. Being indentation-based has nothing to do with that restriction: Nim manages to use indents and to have multiline lambdas at the same time.