raymond.activestate at gmail.com
Fri Oct 22 22:57:50 CEST 2010
On Oct 22, 4:17 am, Peter Otten <__pete... at web.de> wrote:
> I just read the recipe, and it looks good to me except for the len() and
> iter() implementations:
> >>> a = Context()
> >>> a["x"] = 1
> >>> b = a.new_child()
> >>> b["x"] = 2
> >>> len(b)
> >>> b.keys()
> ['x', 'x']
> I would have expected equal keys to occur/count just once.
Thanks for reviewing the recipe.
Since only the first (unshadowed) 'x' is accessible, I can
see why it would make sense to count it only once.
More information about the Python-list