News for hackers. Stuff that matters.
Re:The Python Paradox by nextos on Friday January 27, 2023 @02:43AM (#34543638)
> Ruby is still great for throwing something together fast and maintaining it until it runs into scale problems. It added gradual typing with sorbet and RBS.

I think Ruby is much better than Python for building large applications.

Ruby is essentially Smalltalk with a neat Algol-like syntax and some Perl-isms. Its OO system is a joy to work with.

Python got so popular in data-oriented applications because it's a really simple procedural language.

More importantly, it had the right libraries (NumPy, SciPy and Matplotlib) when Torch (implemented in Lua) was no longer viable (due to LuaJIT limitations).

Re:The Python Paradox by AdamN on Friday January 27, 2023 @08:17AM (#34545597)
That's sort of outdated. Python now has type hints, protocol oriented programming support, and is quite fast (for what it is). This wasn't the case back in the day but it's all there now.
Re:The Python Paradox by anthonygd on Friday January 27, 2023 @08:56AM (#34546033)
Python might have nice features, but it also has terrible features. Like using dicts for everything. It's not enough to allow good practices, you have to prevent (or at least reduce) bad practices.
Re:The Python Paradox by gautamdivgi on Friday January 27, 2023 @09:48AM (#34546625)
You can use dataclasses instead of dict now.
Re:The Python Paradox by ElectricalUnion on Friday January 27, 2023 @10:17AM (#34546954)
Unless you use __slots__, aren't all class-based objects [specifically python2 new style `class MyClass(object): pass` or all python3 classes] dicts in Python?
Re:The Python Paradox by gautamdivgi on Friday January 27, 2023 @10:34AM (#34547141)
I was talking about the dataclasses.dataclass annotation in 3.10/3.11. You can use slots with it.

You’re right, they’re dicts unless slots are used. I read the parent comment and saying you can define types easily. But you can with dataclasses

Re:The Python Paradox by hbrn on Friday January 27, 2023 @12:28PM (#34548909)
Can you elaborate? What exactly is wrong with dicts?
Re:The Python Paradox by ActorNightly on Friday January 27, 2023 @12:32PM (#34548965)
>Like using dicts for everything

Sorry what? This is absolutely not true.

Re:The Python Paradox by nephanth on Saturday January 28, 2023 @11:28AM (#34558913)
I think they meant that the underlying representation for most stuff is a dict.

Global variables are stored in a dict (`vars()`). Unless you use slots, an object is essentially a dict

Doesn't really disturb me because they're not used like a dict in practice though

Re:The Python Paradox by ActorNightly on Friday January 27, 2023 @12:31PM (#34548953)
Rubys biggest downfall was the stupid "fancy" syntax stuff in the language, like not requiring parenthesis or return statements, insert operators, BEGIN/END blocks, e.t.c. All of those make the code base harder to read.

Also I remember the dependency management system was a pain in the ass to deal with, especially with modules with native libraries.

Python had some issues with 2, but when 3 came around and fixed all that, it became the language of choice specifically because of its consistency.