On Sep 20, 3:22Â pm, Kay Schluehr <[EMAIL PROTECTED]> wrote: > On 20 Sep., 18:33, Bruno Desthuilliers > > <[EMAIL PROTECTED]> wrote: > > The following definitions are AFAIK the only commonly accepted > > definitions about OO: > > > 1/ an object is defined by identity, state and behaviour > > 2/ objects interacts by sending messages each other > > 3/ an OO program is made of interacting objects > > > I let you find out whether Python meets these 3 definitions - and if > > Java does (hint : in Python, everything you can bind to a name is an > > object - this is not true in Java or C++). > > This is correct but it detracts from a more general problem of > language "paradigms". > > Assume you type > > >>> 2+2 > > 4 > > Now you are free to interpret this as a simple, primitive arithmetic > operation but you can also claim that 2 sends an __add__ message to 2. > Hereby the state of the 2 objects are not altered but a new 4 object > is created. OO babble is more impressive isn't it? > > Actually it is simply wrong in the mentioned case and here is the > proof: > > def foo(): > Â Â return 2+2 > > import dis > dis.dis(foo) > > Â 2 Â Â Â Â Â 0 LOAD_CONST Â Â Â Â Â Â Â 2 (4) > Â Â Â Â Â Â Â 3 RETURN_VALUE > > OO is a heuristic method used to understand the semantics of a > programming language. It can also inspire language design but as > you've rightly said: jugde yourself and see how far you get with it. > > Applying OO on interpreter level is by no means a sign of a high > quality implementation whereas structuring programs in the large will > likely benefit from class based organization and encapsulation. Of > course one can also reverse the value hierarchy and find perverse joy > in having a pure OO language but apply monkey patching everywhere. I > suppose you know which language I'm talking about...
It sounds like you think that you -can- write OO programs in Python, but you don't have to. I agree. -- http://mail.python.org/mailman/listinfo/python-list