News for hackers. Stuff that matters.
Re:Ask HN: Why Did Python Win? by CTmystery on Tuesday August 29, 2023 @04:46PM (#37313796)
Only one of the items in your "such as" list is unique to python's philosophy, and that is "there should be one way to do it". Ruby embraces the many ways to accomplish something, it's true. However, the three others are not unique to python. Ruby especially embraces "readability counts". And I can't think of anything in the ruby language itself that is implicit over explicit. Perhaps you are thinking of rails and comparing that to python.
Re:Ask HN: Why Did Python Win? by kstrauser on Tuesday August 29, 2023 @05:01PM (#37314034)
For me, the Ruby community's comfort with monkey patching was a big turn off. In Python, you can hack around on class and replace its methods, but if you do, it's expected that your coworkers might stick you in a dunk tank and sell tickets. It's just not the thing that's done.
Re:Ask HN: Why Did Python Win? by nextos on Tuesday August 29, 2023 @05:26PM (#37314361)
Monkeypatching is maybe more of a Rails thing than Ruby. I think the biggest problems with Ruby around the time Python began to take off were slowness (MRI was a disaster, slow, and full of memory leaks), plus patchy documentation (lots of things were in Japanese).

Still, I preferred and prefer Ruby. Python has fantastic libraries, but it is a mediocre language. Ruby feels like a simpler version of Perl + Smalltalk, and it is a joy to use. Python has intentionally crippled anonymous functions plus syntactic whitespace, which often leads to long and ugly code.

I think it is a shame Guido hated functional programming and he did not embrace an Algol-like syntax with begin/do end blocks. Those two things could have vastly improved Python. Ruby's block, procedure and lambda design is a stroke of genius that yields beautiful code and makes DSLs trivial.

Re:Ask HN: Why Did Python Win? by fuzztester on Tuesday August 29, 2023 @11:42PM (#37317408)
>Ruby's block, procedure and lambda design is a stroke of genius

Hardly. Not only was it nothing great, it had many variations, making it harder to remember.

Re:Ask HN: Why Did Python Win? by EdwardDiego on Tuesday August 29, 2023 @05:13PM (#37314193)
I figure if Django built an entire framework around metaprogramming, I'm going to do it to Django model objects as a form of vengeance.
Re:Ask HN: Why Did Python Win? by kstrauser on Tuesday August 29, 2023 @05:16PM (#37314242)
I want to see the malicious wonders you can create!
Re:Ask HN: Why Did Python Win? by EdwardDiego on Tuesday August 29, 2023 @05:34PM (#37314448)
An easy way to start taking the fight back to the enemy is by overriding __new__ and tinkering with things before/after Django's metaclass __new__ does its own metafoolery.

Also overriding mro() is a fun way to monkey with the inner workings.

Re:Ask HN: Why Did Python Win? by fuzztester on Tuesday August 29, 2023 @08:58PM (#37316290)
Whereas in Ruby you get to go to a conf for doing that.
Re:Ask HN: Why Did Python Win? by fuzztester on Tuesday August 29, 2023 @11:38PM (#37317381)
Re:Ask HN: Why Did Python Win? by JohnBooty on Tuesday August 29, 2023 @10:10PM (#37316817)

    For me, the Ruby community's comfort with monkey patching was a big turn off
If it helps, the Ruby community really soured on monkeypatching in general quite a while back. You don't see it much these days and every decent book or guide warns against it.

It was definitely a crazier place 10+ years ago in the early Rails days.

Re:Ask HN: Why Did Python Win? by fuzztester on Tuesday August 29, 2023 @11:37PM (#37317373)
>It was definitely a crazier place 10+ years ago in the early Rails days.

Yeah! It sure was.

I was around, was an early Ruby and Rails adopter, and worked on a few commercial Rails projects at that time.

That's how I know about the monkey patching issues. Faced them in real life.

Re:Ask HN: Why Did Python Win? by JohnBooty on Wednesday August 30, 2023 @09:50AM (#37322150)
I certainly wouldn't blame a person for experiencing those crazier days and thinking the community didn't have the greatest technical vision.

I played around with Rails and Ruby when Rails first blew up. But I didn't start doing it fulltime professionally until 2014. By the time it seemed to me that the community was maturing. I think it's in a good place now.

Re:Ask HN: Why Did Python Win? by ysavir on Tuesday August 29, 2023 @04:56PM (#37313959)
Ruby has implicit return values for methods, but unless I'm wrong, so does Python.
Re:Ask HN: Why Did Python Win? by kstrauser on Tuesday August 29, 2023 @05:05PM (#37314089)
Python's only implicit return value is the default `None`.
Re:Ask HN: Why Did Python Win? by ysavir on Tuesday August 29, 2023 @07:03PM (#37315327)
Thanks! Adding that to the things I've learned (or unforgotten, I guess is more accurate)
Re:Ask HN: Why Did Python Win? by dragonwriter on Tuesday August 29, 2023 @06:39PM (#37315081)
Python has a default None return, Ruby returns the value of the last expression.

Neither (except maybe the None case in Python) is really implicit, Ruby is just an expression oriented language while Python is statement-oriented.

OTOH, in Ruby the keyword “return” is superfluous except for altering control flow for an early return, while in Python it is the mechanism for supplying a return value.

Re:Ask HN: Why Did Python Win? by KptMarchewa on Tuesday August 29, 2023 @07:56PM (#37315807)
> Python has a default None return, Ruby returns the value of the last expression.

I would really hate this feature in a language without strong static typing.

Re:Ask HN: Why Did Python Win? by randomdata on Tuesday August 29, 2023 @10:51PM (#37317086)
Doesn’t seem like that big of a deal. You’re going to have a really hard time getting your first test to pass if you make a mistake.

I don’t mean using testing as a poor man’s type system, I mean even the tests you would write in a statically typed language will quickly uncover any mistakes you could possibly make there.

Re:Ask HN: Why Did Python Win? by KptMarchewa on Wednesday August 30, 2023 @09:21AM (#37321721)
In statically typed systems, this wouldn't even compile.

I'm pretty sure I'd see multiple cases where the function would return different types depending on a code path.

Re:Ask HN: Why Did Python Win? by dragonwriter on Wednesday August 30, 2023 @12:22PM (#37324383)
> I'm pretty sure I'd see multiple cases where the function would return different types depending on a code path.

Quite commonly by design, or, “why union (and sum) types are a thing”.

Something returning type “Foo | nil” is very often going to return Foo on one branch and nil on another.

Re:Ask HN: Why Did Python Win? by randomdata on Thursday August 31, 2023 @08:55AM (#37336424)
> In statically typed systems, this wouldn't even compile.

Still, it's not like you're going to miss that a function doesn't return something expected. Even in statically typed languages you are going to have tests to validate that much.

> I'm pretty sure I'd see multiple cases where the function would return different types depending on a code path.

That's another problem entirely. Although even then it would be pretty hard for an errant type to not blow up your tests. Again, not tests specifically meant to check that your types or sane, just the same tests you would write in a statically typed language.

Re:Ask HN: Why Did Python Win? by pcthrowaway on Tuesday August 29, 2023 @06:40PM (#37315089)
> And I can't think of anything in the ruby language itself that is implicit over explicit

This is surprising to me. I love ruby, but it embraces implicitness more than any other language I've used. method_missing, monkey patching internals, and other types of metaprogramming make things very implicit at the interface level

Re:Ask HN: Why Did Python Win? by cutler on Tuesday August 29, 2023 @07:17PM (#37315473)
If you want to really experience the true horror of implicit try Scala.
Re:Ask HN: Why Did Python Win? by lmm on Tuesday August 29, 2023 @08:03PM (#37315871)
Scala's implicits are a lot less unpleasant because the type system means that you (and, perhaps more importantly, your IDE) know exactly where they're happening.
Re:Ask HN: Why Did Python Win? by gilcot on Tuesday August 29, 2023 @08:12PM (#37315944)
> Ruby embraces the many ways to accomplish something, it's true.

Far less true than with Perl.

In another hand, many questions I asked about Python came with various way to do the stuff. So I'm not sure about that advertisement.