word1.word2 notation
Magnus L. Hetland
mlh at idt.ntnu.no
Tue Aug 24 19:53:37 EDT 1999
Yeoh Yiu <squid at panix.com> writes:
> I've noticed in various languages, there is a construction
> of expressions with a dot in the middle. It is a construction
> because the name with a dot in the middle is never explicitly
> declared, as in
>
> int foo.bar = 42; // doesn't happen this way
>
> but rather foo is declared in one place and method (or some other
> type of entity) bar was declared somewhere else and foo.bar was
> always available implicitly as a latent method (or as something).
>
> What is the name of this technique and the name of methods
> (or variables ?) so constructed ?
Hm. Maybe I'm missing something here... But if this question is as
basic as I think, then maybe this will be an adequate answer:
The construction you are referring to is a "member reference". In the
example above, you refer to the member variable "bar" of the object
"bar". In cases in which the member is a function (of - actually, a
method) which is called in the reference, it is called a "method
call", as in:
foo.bar()
You might want to look into how object-oriented programming works in
general to further appreciate the meaning of this.
>
> squid.
>
--
Magnus Making no sound / Yet smouldering with passion
Lie The firefly is still sadder / Than the moaning insect
Hetland : Minamoto Shigeyuki
More information about the Python-list
mailing list