Re: Using non-dict namespaces in functions

2012-03-18 Thread Peter Otten
Steven D'Aprano wrote: > On Sat, 17 Mar 2012 11:42:49 -0700, Eric Snow wrote: > >> On Sat, Mar 17, 2012 at 4:18 AM, Steven D'Aprano >> wrote: >>> Note that it is important for my purposes that MockChainMap does not >>> inherit from dict. >> >> Care to elaborate? > > I want to use collections.C

Re: Using non-dict namespaces in functions

2012-03-17 Thread Steven D'Aprano
On Sat, 17 Mar 2012 11:42:49 -0700, Eric Snow wrote: > On Sat, Mar 17, 2012 at 4:18 AM, Steven D'Aprano > wrote: >> Note that it is important for my purposes that MockChainMap does not >> inherit from dict. > > Care to elaborate? I want to use collections.ChainMap, or something very like it, an

Re: Using non-dict namespaces in functions

2012-03-17 Thread Eric Snow
On Sat, Mar 17, 2012 at 4:18 AM, Steven D'Aprano wrote: > Note that it is important for my purposes that MockChainMap does not > inherit from dict. Care to elaborate? > Now I try to create a function that uses a MockChainMap instead of a dict > for its globals: > > function = type(lambda: None)

Using non-dict namespaces in functions

2012-03-17 Thread Steven D'Aprano
Inspired by the new collections.ChainMap in Python 3.3 http://docs.python.org/dev/library/collections.html#collections.ChainMap I would like to experiment with similar non-dictionary namespaces in Python 3.2. My starting point is these two recipes, adapted for Python 3.2: http://code.activesta