[Tutor] What is a "state variable"?
Steven D'Aprano
steve at pearwood.info
Fri Nov 12 02:42:08 CET 2010
Walter Prins wrote:
> Usually however people mean that objects (instances) have state variables,
> even when they talk about classes. The trouble is that classes are
> themselves objects, and can in fact have their own stat.
This is true for Python, and Ruby, but not all languages.
> So what is state? Well, your toaster has a "powered" state, it's either "on"
> or "off".
A better example would be the toaster setting, usually something like
1-5 or thereabouts.
--
Steven
More information about the Tutor
mailing list