breamoreboy at yahoo.co.uk
Sat Feb 25 01:39:39 CET 2012
On 24/02/2012 22:25, Steven D'Aprano wrote:
> 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.
Surely you mean names, not variables? :)
More information about the Python-list