[Tutor] Beginner question (variables, namespaces...) (fwd)

Danny Yoo dyoo at hkn.eecs.berkeley.edu
Sat Apr 8 18:21:00 CEST 2006


> > ..which is not what I'm aiming for. Maybe I'll have to follow Bob's
> > advice and just store all of the variable assignments in a function,
> > and then call the function every time I change one of the variables
> > (based on user input). I could still leave the higher-order variables
> > as functions as per your advice, but that alone doesn't seem to do the
> > trick. Unless I've missed something.
>
> Danny's suggestion of using class properties is a good one, it allows
> you to automate the recalculation of the variables, and also protect
> against directly assigning one of the calculated values.

Just wanted to clarify that this is not my suggestion: Alan proposed this.

But I think we should steer away a little away from full-fledged classes
at the moment.  The "professional" solution would be to do this, but I'm
not sure how appropriate it is for Jesse to do this yet.  Jesse is still
confused about how variables work.  In which case, suggesting him to look
at classes will just make things worse.  *grin*



More information about the Tutor mailing list