While everyone is saying what they want in Python :)
Daniel
Daniel.Kinnaer at Advalvas.be
Tue Feb 6 16:48:19 EST 2001
On Tue, 06 Feb 2001 15:17:05 GMT, ullrich at math.okstate.edu (David C.
Ullrich) wrote:
>
>Delphi's "with" is more or less the same except without the
>dots at the start of the field names. For a long time I've
>seen Delphi people say that with is bad, the reason
>being it leads to bugs
I've been programming in Delphi for quite some years now (only
"discovered" Python a few months ago), and I'd like to react on this,
though.
The part where I find the 'with' command interesting is for
readability. Consider :
MySpecialButton := TSpecialButton;
MySpecialButton.caption := 'Busy';
MySpecialButton.method2;
MySpecialButton.caption := "Ok";
or
MySpecialButton := TSpecialButton;
with MySpecialButton do
begin
caption := 'Busy';
method2;
caption := 'Done';
end;
Which code would you prefer?
Perhaps that there is a parent or child of this class which also
knows method2 (and perhaps is overrridden). If I don't specify, the
Delphi-compiler will either complain or weird things will start to
happen :)
E.g. table1.close (to close a table) and Form1.Close (to close the
program). If I would just use 'Close' there is a big chance the
program just terminates (instead of closing the table :)
Just my 2cents...
groetjes,
Daniel
More information about the Python-list
mailing list