word1.word2 notation

Yeoh Yiu squid at panix.com
Tue Aug 24 03:18:37 EDT 1999

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 ?

Sorry if this is horribly unclear.  Perhaps an example or two would help:

Here's a python example; datfile.readline() is the thing I'm talking about.

>  datafile = open("/tmp/words", "r");
>  line = datafile.readline()

Here's a visual basic example:

> From MS Word VB Help:  SaveAs
> =====
> Saves the specfied document with a new name or format. The arguments for
> this method correspond to the options in the Save As dialog box (File menu).
> Syntax
> expression.SaveAs(FileName, FileFormat, LockComments, Password,
> AddToRecentFiles, WritePassword, ReadOnlyRecommended, EmbedTrueTypeFonts,
> SaveNativePictureFormat, SaveFormsData, SaveAsAOCELetter)
> expression   Required. An expression that returns a Document object.
> FileName   Optional Variant. The name for the document. 
> FileFormat   Optional Variant. The format in which the document is saved.


More information about the Python-list mailing list