Not fully OO ?
"Martin v. Löwis"
martin at v.loewis.de
Sun Sep 21 04:54:56 EDT 2008
Christian Heimes wrote:
> Kay Schluehr wrote:
>> Actually it is simply wrong in the mentioned case
[...]
>
> It's not wrong. You have found a simple optimization. Lot's of compilers
> for lots of languages optimize code by code folding.
I don't think he meant that Python is wrong somehow, but that the OO
babble of what happens for 2+2 is wrong. The babble said that, when the
code is executed, an __add__ message is sent to the 2 object, with
another 2 object as the parameter. That statement is incorrect: no
message is sent at all, but the result is available even before the
program starts.
FWIW, "2+2" is not a good case for OO in Smalltalk, either. In a typical
implementation, SmallInteger is not a real class, in the sense that 2 is
not a real object. Instead, it lives in a tagged pointer, i.e. it has no
identity.
Regards,
Martin
More information about the Python-list
mailing list