On 04 Feb 2006 11:03:00 +0000 [EMAIL PROTECTED] (Jens Theisen) wrote: > n.estner wrote: > > Yes, I 100% agree to that point! > > But the point is, the current situation is not > > newbie-friendly (I can tell, I am a newbie): I declare a > > method with 3 parameters but when I call it I only pass > > 2 parameters. That's confusing. If I declare a member > > variable, I write: "self.x = ValueForX", why can't I be > > equally explicit for declaring member functions? > > For someone new to OO in general it might as well be > something good, so he realises that there actually > really is a hidden parameter. After all, there is > something to understand with "self", and this discrapency > between the number of arguments and parameters puts > newbies to it.
Yes. I have to say that I learned OOP at the same time as Python (I made attempts with C++ that were moderately successful, but beyond implementing new math objects, I couldn't really see the benefit OOP then. I didn't "get" it until I started using Python). So, the idea of "the object itself is the first argument to the function" made it implicitly clear to me what the heck was this whole business about "methods". I found the Python approach is very enlightening. By contrast, Javascript seems positively obtuse. First, the equivalent to "self" is a magically-appearing variable called "this". But to make matters worse, this behavior is repeated in many places -- you have to know when and where magical variables like "this" and "prototype" appear, and it's not at all obvious when reading other people's code. (I suppose a formal introduction to Javascript would explain these things -- but I note that many online "how to" type documents skip them, partly because OOP is not very popular with most casual Javascripters). I tend to think of Javascript as "almost Python, but stupidly designed", because of stuff like this. My apologies to Javascript fans, I acknowledge that my opinion is subjective. ;-) Cheers, Terry -- Terry Hancock ([EMAIL PROTECTED]) Anansi Spaceworks http://www.AnansiSpaceworks.com -- http://mail.python.org/mailman/listinfo/python-list