"Jeremy Sanders" <[EMAIL PROTECTED]> wrote:
| 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
- Sneaky! - I like this....
- Hendrik
--
http://mail.python.org/mailman/listinfo/python-list