How to check class instances? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to check class instances?

Pls how do I check all the instances created from a class. E. g: class Sololearner: def ask(self): print(questions) Elijah = Sololearner() Jan-Markus = Sololearner() Input: #function I'm looking for Output: Elijah, Jan-Markus

1st Jul 2021, 3:29 PM
Nwalozie Elijah
Nwalozie Elijah - avatar
1 Answer
0
Thanks man. The reason i wanted to do this is, I created a class and some subclasses of it and i started to create many objects from it and lost track of them. So i started to look for function which when i run, will produce all the instances i've created. P.S I don't really understand anything in your code 😥😥 a few comments will help
1st Jul 2021, 11:22 PM
Nwalozie Elijah
Nwalozie Elijah - avatar