Brad's Blog

An Attribute by any other name... 2013-09-11

Let's explore some python attributes, shall we? (note: this is python 2.7.x) Attributes Let's consider a simple class, N, with a single attribute, numbers containing values 0 - 9. class N(object): numbers = range(10) # [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] We can create an instance of this class, then perform some operations on the attribute (like accessing or setting its values). >>> n = N() >>> n.numbers # get the value of the ...