Python move from attribute to his class

O

omEchan

Guest
Suppose i have this code:

Class abc():

def __init__(self):

self.a = 0

def somefunc(var):

if __name__ == "__main__":

aaa = abc()

somefunc(aaa.a)

Now my question, there is a way to get an instance of the class (aaa) by his attribute (a) that passed to "somefunc" if i have only the attribute? In other words, to move from attribute to his class.

I know that is not popular to do that but i have some situation that forces me to.

Thank you for help!!!!

Continue reading...
 
Top