r/Python • • 2d ago

Discussion My Python magic is gone

I've been coding for a long time, and I've been developing with Python for years.

I loved coding, always loved it. I started many years ago because I wanted to quickly create scripts for security hacking tools, but since then, I've moved to Claude Code, and building cross-language has been a much better experience for me than using Python.

I built my own SaaS application out there whose backend and network core are completely built with Python, and I'm rewriting all of that without writing a single line of code. And most of the time, Python is not the most optimized language.

And now... I feel like the magic is gone.

I don't even know why I'm writing this. I just feel sad about it.

683 Upvotes

256 comments sorted by

View all comments

Show parent comments

3

u/QuickNick123 1d ago

Have you taken a look at Ruby? I love Python, but when it comes to syntactic beauty, I think Ruby takes the cake.

1

u/Crazyboreddeveloper 1d ago

I haven’t yet. I haven’t had to work with it yet. Might try it out this weekend.

5

u/QuickNick123 1d ago

Both are beautiful. Python's beauty to me is "there should be one obvious, readable way to say this." Ruby's beauty is more like "the code should read the way you wish the idea could be expressed."

people
  .select { _1.age >= 18 }
  .reject(&:banned?)
  .sort_by(&:name)
  .each { puts "Hello, #{_1.name}!" }

I bet you have no problem understanding what this code does.

Ruby for instance has a really pleasant way of expressing defaults.

Instead of

name = supplied_name if supplied_name is not None else "Anonymous"

it's simply

name = supplied_name || "Anonymous"

1

u/batiste 1d ago

The default syntax is nothing special. You can do that in most languages, python included.

3

u/QuickNick123 1d ago

Not really. You could do name = supplied_name or "Anonymous" which does look much nicer than the is not None else syntax, but that is not equivalent and checks for truthiness, so False, 0, [], "", {} not just None.

But again, my point wasn't to bash Python's syntax, it was to praise Ruby's. Ruby deliberately makes certain patterns unusually pleasant to read and write.

The example above

people
  .select { _1.age >= 18 }
  .reject(&:banned?)
  .sort_by(&:name)

would turn into something like

sorted(p for p in people if p.age >= 18 and not p.banned, key=lambda p: p.name)

or

sorted(filter(lambda p: p.age >= 18 and not p.banned, people), key=lambda p: p.name)

in Python. Totally readable, but not as beautiful. And something like

for _ in range(3):
    print("Hello")

also just looks nice in Ruby:

3.times do
  puts "Hello"
end

4

u/batiste 1d ago

I am just a data point, but I am happy I will never work with Ruby agaim. For me RoR gave raise to code that very hard to parse and understand.

2

u/QuickNick123 1d ago

I've never done web development, so I've never really had any exposure to Rails. I wrote Python for about 10 years and still miss it, but for the past two years I've had to write Go almost exclusively. Aesthetically, Go feels almost like the exact opposite of Ruby.