"Peter Maas" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Davor schrieb: >> so initially I was hoping this is all what Python is about, but when I >> started looking into it it has a huge amount of additional (mainly OO) >> stuff which makes it in my view quite bloated now. > > So you think f.write('Hello world') is bloated and file_write(f,'Hello > world') > is not? This is the minimum amount of OO you will see when using Python.
Now that we have gently teased Davor for his OO fear, I think we should acknowledge that his fears, and specifically his bloat fear, are not baseless. In Python, one can *optionally* write a+b as a.__add__(b). That is bloat. I believe, in some strict OO languages, that bloat is mandatory. For one operation, the bloat is minor. For ever a relatively simple expression such as b**2-4*a*c, it becomes insanity. If we were to have to write sin(x) instead as x.sin(), there would not be syntax bloat. And it would be easier to write generic float-or-complex math functions, just as your print example shows how __str__ methods facilitate generic print operations. But if the class method syntax were manditory, there would be class and/or class hierarchy bloat due to the unlimited number of possible functions-of-a-float and large number of actual such functions that have been written. On the other hand... curryleft(list.append, somelist) is a bit more to type than somelist.append. > print "*** Davor's evolution towards an OO programmer ***" Your Four Steps to Python Object Oriented Programming - vars, lists, dicts, and finally classes is great. It makes this thread worthwhile. I saved it and perhaps will use it sometime (with credit to you) to explain same to others. Terry J. Reedy -- http://mail.python.org/mailman/listinfo/python-list