Re:Lisping at JPL Revisited
by pjmlp on Sunday January 29, 2023 @06:20AM
(#34567078)
Although the early versions weren't so, after the replacement of the base object model (see new style classes), in Python everything is an object as well, and many seem to miss that.
produces,
[ Parent
| on HN ]
That's true, but actually using a literal as a object is forbidden by the syntax.
Python 3.8.9 (default, Mar 30 2022, 13:51:16)
[Clang 13.1.6 (clang-1316.0.21.2.3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> 1.__abs__
File "<stdin>", line 1
1.__abs__
^
SyntaxError: invalid syntax
>>>
Ruby allows this: irb(main):001:0> 1.2.to_s
=> "1.2"
I think that's weird.Only because those are special methods only allowed to be directly called by the runtime, doesn't change that the language model is actuall OOP based.
You could have used one of those that is allowed instead, example:
>>> (3.2).is_integer()
False
The parentheses are needed due to parsing precendence.So here is your Ruby like example in Python.
Fair enough. I guess I should probably take another look at Ruby.