steve+comp.lang.python at pearwood.info
Fri Feb 24 23:25:44 CET 2012
On Fri, 24 Feb 2012 10:08:43 -0800, David wrote:
> Your code updated to show the difference between a variable, a class
> variable, and an instance variable.
The preferred terms in Python circles are class and instance
*attributes*, not variables.
An integer variable is a variable holding an integer.
A string variable is a variable holding a string.
A list variable is a variable holding a list.
Therefore a class variable is a variable holding a class, and an instance
variable is a variable holding an instance.
Yes, in Python, classes and types are first-class objects (pun not
intended), and it is quite common to store them in variables:
for cls in (int, float, Decimal, Fraction, myint, myfloat):
Other languages may choose to use illogical terminology if they choose.
More information about the Python-list