Paul Rubin: > As a couple of people have said, you could make a dict subclass that > notices when you do updates. I think the real answer is a > "functional" dictionary, which means one that is never updated.
Python V. 2.4, 2.5, 2.6. 3.0 have gained more and more lazy-style features, this is changing a little how normal Python programs are written (compared for example with Haskell, using lazy computations in Python is less handy and probably less safe too, because for example in Haskell you can define something that lazily generates an infinite sequence of items, this is now easy to do in Python too, but in Haskell inside the generator you can use items generated in the past too, and the generators don't exhaust). In the last years functional languages are raising their elegant lambda-shaped heads more and more, so today you can find several immutable data structures in Scala and F# languages (and in the D language true closures, simple ways to state recursively immutable things, and even pure functions. This will make D like a cleaned up, simplified and improved C++ with functional features added. Then D3 may add AST macros. At that point pattern-matching programming, dataflow programming, constraint programming and Logic programming become the few programming styles not supported natively). So maybe in the following years Python too may gain few other immutable data structures, fitter for a functional style of programming (in Python there are already some immutable data structures, like strings, tuples, frozensets, and I sometimes use frozendicts. Time objects and time deltas too are often good kept as immutable). Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list