[Tutor] Languages, was Which programming language is better

alan.gauld@bt.com alan.gauld@bt.com
Fri, 29 Mar 2002 11:07:29 -0000


> What's this 'with'?
> 
> In FoxPro we have the following (maybe similar):
> with this.parent.parent.otherwidget
>      .subwidget1.value = 1
>      .subwidget2.value = 2
>      .subwidget3.value = 3
>      ...
> endwith

Exactly the same(but without the preceding dot. 
Syntactic sugar but saves some typing.

> But in Python you can do something very similar just by
> assigning the unchanging part of the path to a variable

Yes, and I do that in extreme cases but it clutters up 
the namespace a bit. (You use the same trick in Java/C++ 
with a temporary pointer assigned to the nested target)

Alan g.