I'm trying to store a function in python dictionary that minipulates some ranges from the dictionary it self, but I don't how to pass self
to the function, ex:
d = {"r": range(10), "r2": range(10, 20), "f": lambda self: self["r"].extend(self["r2"])}
I expect it to return extended list like: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]
but when I call d["f"]()
I get TypeError: <lambda>() takes exactly 1 argument (0 given).
even when I do d["f"](d)
I get nothing !
>>> d["f"](d)
>>>
so is it even possible ? and how ? thank in advanced.
UPDATE 1
I want to pass self to the dictionary to filter the some values within the dictionary, and classing is not an option because my case is to use that in google-app-engine here's my question about that
so classing won't work (I've got to this because I can't store classes in datastore so I use subclassed dictionaries instead see my other question above)