Let's say I have the following code:
def function(k):
# do something here
d = { 0: 'a', 1: 'b', 2: 'c' }
function(d[0])
Is it possible for the function
to find out what are the other keys in the d
? For example is there such a thing:
def function(k):
print k.__parent__.keys()
I don't think there is such a feature (as it would be a significant security issue). However I don't know much about the technical implementation to know that for sure.
EDIT: The motivation was if everything in Python is an object, is it possible to find other objects that are bound to it, in this case the parent dictionary.