[Tutor] Tutor Digest, Vol 29, Issue 66
Carroll, Barry
Barry.Carroll at psc.com
Wed Jul 26 18:50:39 CEST 2006
Greetings:
> -----Original Message-----
> Date: Wed, 26 Jul 2006 10:11:28 +0100
> From: "Alan Gauld" <alan.gauld at btinternet.com>
> Subject: Re: [Tutor] loops to assign variables
> To: tutor at python.org
> Message-ID: <ea7bk8$8hi$1 at sea.gmane.org>
>
<<snip>>
>
> "John CORRY" <john.corry at ntlworld.com> wrote
>
> > For example, I have 30 textentry boxes numbered from entry20 to
> > entry50.
> > I have used the following code to assign the entryboxes to a local
> > name.
> >
> > text20 = self.wTree.get_widget("entry20")
> > text21 = self.wTree.get_widget("entry21")
>
> This is not a resonse to Johns original request but a general
> comment on variable naming. It seems quite common in GUI
> work for folks to use this style of entryN, buttonM etc.
>
> But its not very programmer friendly! We wouldn't normally
> call our variables var1, var2 etc it makes the intent of the code
> much harder to comprehend. So we choose meaningful variable
> names like width, height, name, location etc.
>
<<snip>>
I agree with Alan here. Unless the numbers reflect some property of the
object being modeled (room numbers in a hotel, airline flight numbers,
TV channels, etc), they should not be used in the widget name.
My $0.02.
Regards,
Barry
barry.carroll at psc.com
541-302-1107
________________________
We who cut mere stones must always be envisioning cathedrals.
-Quarry worker's creed
More information about the Tutor
mailing list