Re: variables in Py
- Posted by David Cuny <dcuny at LANSET.COM> Oct 21, 2000
- 462 views
Jerry Story wrote: > number = 0 -- The variable 'number' is created > ... > numer = 0 -- Another variable is created, by a typo. > > In a normal language, this is caught instantly as "undeclared" and I can > fix it instantly. 'normal' language. heh. I've used QBasic, and suffered from the same sort of problems that you are alluding to. No language is foolproof, and the method that Py uses (in this case, taken directly from Python) isn't as 'safe' as the one Euphoria uses. It also fails to enforce the datatype of a variable. But I think that, in this case, it offers a reasonable level of safety. Get back to me in a couple of months, and I could have a different opinion. But it's worth trying out. > I used to program in GFA Basic. It did not have explicit > declarations of global variables, and consequently simple > typos tended to cause major trials and tribulations. The use of namespaces in Py greatly reduces the problems with global variables. Thanks for the feedback! -- David Cuny