While everyone is saying what they want in Python :)
David C. Ullrich
ullrich at math.okstate.edu
Wed Feb 7 10:43:10 EST 2001
More information about the Python-list mailing list
Wed Feb 7 10:43:10 EST 2001
- Previous message (by thread): While everyone is saying what they want in Python :)
- Next message (by thread): Ask for help of VB
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
In article <8w_f6.13141$AH6.1969901 at newsc.telia.net>, "Fredrik Lundh" <fredrik at effbot.org> wrote: > Daniel Kinnaer wrote: > > 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? > > b = mybutton = TSpecialButton() > b.caption = "Busy" > b.method2() > b.caption = "Ok" > > (variables are just names in Python -- you can have any > number of names pointing to the same thing...) You can do more or less the same thing in Pascal. Doesn't have the same effect of reducing the amount of typing while keeping things explicit, because (at least in Delphi) the syntax would be NewNameFortheButtonThatIInventedToSaveKeystrokes:= mybutton; NewNameFortheButtonThatIInventedToSaveKeystrokes.caption:= 'Busy'; > Cheers /F > > -- Oh, dejanews lets you add a sig - that's useful... Sent via Deja.com http://www.deja.com/
- Previous message (by thread): While everyone is saying what they want in Python :)
- Next message (by thread): Ask for help of VB
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list