News for hackers. Stuff that matters.
Re:Verb-Noun vs. Noun-Verb by cortesoft on Thursday October 17, 2019 @12:22AM (#21278887)
This is one of the reasons I like ruby better than python... none of the magic 'dunder' methods... if you want to define a custom adder for your class, so "foo + bar" works, you do "def +()" in ruby instead of "def __add__ ()" in Python.... I love that ruby just uses the actual operator instead of some arbitrary method name you have to remember.
Re:Verb-Noun vs. Noun-Verb by lifthrasiir on Thursday October 17, 2019 @03:15AM (#21279644)
> none of the magic 'dunder' methods

Ruby do have equivalents to Python magic methods... disguised as normal methods. For example Python `__hash__` is Ruby `hash` and both are used by built-in dict/hash values and you should be aware of that fact in both. There are some philosophical differences as well, Python likes to have standalone functions that are customized via magic methods (e.g. `str` vs. `__str__`, you don't normally call the latter) and in Ruby everything is method (e.g. `to_s`). It really seems like a matter of taste.