namespace question
Mark Lawrence
breamoreboy at yahoo.co.uk
Fri Feb 24 19:39:39 EST 2012
More information about the Python-list mailing list
Fri Feb 24 19:39:39 EST 2012
- Previous message (by thread): namespace question
- Next message (by thread): namespace question
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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): > do_something_with(cls) > > > Other languages may choose to use illogical terminology if they choose. > Surely you mean names, not variables? :) -- Cheers. Mark Lawrence.
- Previous message (by thread): namespace question
- Next message (by thread): namespace question
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list