Hendrik van Rooyen wrote: > What do you guys think?
You could get something similar using an object, such as
class Hist(object):
def __init__(self):
self.vals = [None]
def __call__(self, index=-1):
return self.vals[index]
def set(self, val):
self.vals.append(val)
a = Hist()
a.set(5)
print a()
a.set('hi there')
print a()
print a(-2)
Which prints
5
hi there
5
--
Jeremy Sanders
http://www.jeremysanders.net/
--
http://mail.python.org/mailman/listinfo/python-list
