Python 3K or Python 2.9?

TheFlyingDutchman zzbbaadd at aol.com
Thu Sep 13 03:18:01 CEST 2007


On Sep 12, 5:47 pm, Ben Finney <bignose+hates-s... at benfinney.id.au>
wrote:
> TheFlyingDutchman <zzbba... at aol.com> writes:
> > I am talking about how an author describes in English the "this"
> > pointer/reference in their book on programming C++ or Java.
>
> > I don't think you will find them saying that under the covers "this"
> > was passed to the method (if in fact it is). They just say that it
> > refers to the current object inside that object's method.
>
> In other words, it's magic, and the behaviour has to be explained so
> the reader knows where the undeclared 'this' comes from.

I would disagree that it _has_ to be explained where it came from. I
think knowing that the compiler is providing it is sufficient. Any
further knowledge of what the compiler is doing under the covers to
provide it is unnecessary. Sun made no mention of where "this" comes
from in that link I provided.

>
> How is that preferable to the magic of "instance is passed as the
> first argument to a method"?

I would mention that an instance is passed as the first parameter
argument of a method if the methods were declared with the extra
argument and called with the extra argument:


a = MyClass()

my_method(a,someParameter)

Then it makes sense to me to talk about it.







More information about the Python-list mailing list