4 ms·
It is sad to me that you hate Ruby. It is a better language than Python for my taste in all dimensions except number of libraries available. To begin with I c
by oezi 3y ago
It is sad to me that you hate Ruby. It is a better language than Python for my taste in all dimensions except number of libraries available.
To begin with I could never understand why there need to be those global functions in Python to do meaningful things with lists.
In Ruby the "everything is an object" really works down to every nut and bolt and is clean and very conceptually pleasing.
Whether you call a package a gem, module, jar or whatever isn't very central.
- mixmastamyk 3y agoWas simply for readability, as in similar to English prose. What if the length of my list is greater than 10? if len(mylist) > 10: pass Only general things dealing with common needs are global, list-centric methods are on the list where they belong. I learned Java before Python and don't really miss value.toString() or value.length() much.
- oezi 3y agoBut it is absolutely unintuitive why it shouldn't be if mylist.length > 10
- mixmastamyk 3y agoIf the length of mylist ... see how length comes first? Only unintuitive if you never spoke English or other european languages.
- AlchemistCamp 3y agoThis construction is something my French friend often does in English instead of using a possessive—the <property> of <thing>. As a native speaker of English, I’d just say, “if mylist’s length is more than 10”.
- jbergens 3y agoA really, really bad argument in my opinion. That thinking would lead us to Cobol.
- mixmastamyk 3y agoA really, really bad reply imho—see how useful that is?
- oezi 3y agoWith all other object oriented structures you would think that you want to do something with the mylist, thus you would first write down mylist. In Ruby I thus often write something such as: if mylist.empty?.! Because my line of thinking goes from the object to a function or attribute and then chains further along. Calling the `.!` method on the returned boolean object is very nice, because I don't have to go back to before mylist and insert the !-operator there.
- abenga 3y agoI haven't written any Ruby. Maybe one gets used to this after some time, but this honestly looks like it will enable you to write extremely clever and succinct code that makes perfect sense at the time, but a chore for anyone else to read and grok quickly (including the writer themselves a few weeks later). I could be wrong though.