Nested Mapping

Robert Kern robert.kern at gmail.com
Fri Oct 22 17:48:36 CEST 2010


On 10/21/10 6:19 PM, Raymond Hettinger wrote:

> I would appreciate any feedback on the API and on how well it fits
> with various use cases that you've found in the wild.

We've done something similar in the past:

 
https://svn.enthought.com/svn/enthought/CodeTools/trunk/enthought/contexts/multi_context.py

I'm not sure we'd have much use for a batteries-included collections.Context, 
per se, since we needed the other features of our Context implementation like 
notification and restriction. In particular, we were using our MultiContext with 
subcontext mapping objects that could restrict the types of values that were 
contained in them. We wanted to execute code in a MultiContext and be able to 
separate functions and classes that were defined or imported from other 
variables for display.

As for the API, I would probably want to be able to create a Context simply 
given a list of existing maps rather than needing to build a chain of them using 
.new_child(). Most of the use cases I can imagine are ones where I already have 
populated dictionaries, and I just want to slap this behavior on top of them. 
Other than that, it looks good.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco




More information about the Python-list mailing list