How to get the list of all initialized objects and function definitions alive in Python? Last Updated : 20 Feb, 2023 Comments Improve Suggest changes Like Article Like Report In this article, we are going to get the list of all initialized objects and function definitions that are alive in Python, so we are getting all those initialized objects details by using gc module we can get the details. GC stands for garbage collector which is issued to manage the objects in the memory, so from that module, we are using the get_objects() method Syntax: gc.get_objects() Example 1: Python program to get the details of initialized objects. Here we will create some objects like a list, tuple, dict, and then get the alive initialize object using gc. Python3 # import gc module import gc # create list object a = [1,2,3,4,5] print(a) # create a variable b = 12 print(b) # create tuple object c = (1,2,3,4,5) print(c) # create a dictionary object d = {'a':1, 'b':2} print(d) # get all the initialized objects gc.get_objects() Output: Time Complexity: O(n)Auxiliary Space: O(n) Example 2: Python program to get the list of initialized functions Python3 # import gc module import gc # define a function def geek(name): print(name + " - Hello Geek!") # call the function with names as # parameter geek("sravan") geek("bobby") geek("ojaswi") geek("rohith") geek("gnanesh") # get all the initialized objects gc.get_objects() Output: Comment More infoAdvertise with us Next Article How to get the list of all initialized objects and function definitions alive in Python? sravankumar_171fa07058 Follow Improve Article Tags : Python python-basics Practice Tags : python Similar Reads How to get the memory address of an object in Python In Python, everything is an object, from variables to lists and dictionaries everything is treated as objects. In this article, we are going to get the memory address of an object in Python. Method 1: Using id() We can get an address using the id() function. id() function gives the address of the pa 2 min read How to create a list of object in Python class In Python, creating a list of objects involves storing instances of a class in a list, which allows for easy access, modification and iteration. For example, with a Geeks class having attributes name and roll, you can efficiently manage multiple objects in a list. Let's explore different methods to 3 min read How to get list of parameters name from a function in Python? The task of getting a list of parameter names from a function in Python involves extracting the function's arguments using different techniques. These methods allow retrieving parameter names efficiently, whether from bytecode, introspection or source code analysis. For example, if a function fun(a, 4 min read How to find size of an object in Python? In python, the usage of sys.getsizeof() can be done to find the storage size of a particular object that occupies some space in the memory. This function returns the size of the object in bytes. It takes at most two arguments i.e Object itself. Note: Only the memory consumption directly attributed t 2 min read How to Get a List of Class Attributes in Python? Getting a list of class attributes in Python means identifying all variables defined at the class level, excluding instance attributes and methods. For example, a class might have attributes like name, age and location. The output will be a list or dictionary showing these attribute names and their 3 min read How to Check the Type of an Object in Python In this article, we will explore the essential skill of determining the type of an object in Python. Before engaging in any operations on an object within the Python programming language, it is imperative to possess the knowledge of how to check its type. This fundamental task is encountered regular 4 min read Decorator to print Function call details in Python Decorators in Python are the design pattern that allows the users to add new functionalities to an existing object without the need to modify its structure. Decorators are generally called before defining a function the user wants to decorate. Example: Python3 # defining a decorator def hello_decora 3 min read How to check if an object is iterable in Python? In simple words, any object that could be looped over is iterable. For instance, a list object is iterable and so is an str object. The list numbers and string names are iterables because we are able to loop over them (using a for-loop in this case). In this article, we are going to see how to check 3 min read Initialize an Empty Dictionary in Python To initialize an empty dictionary in Python, we need to create a data structure that allows us to store key-value pairs. Different ways to create an Empty Dictionary are:Use of { } symbolUse of dict() built-in functionInitialize a dictionaryUse of { } symbolWe can create an empty dictionary object b 3 min read How to initialize all the imported modules in PyGame? PyGame is Python library designed for game development. PyGame is built on the top of SDL library so it provides full functionality to develop game in Python. Pygame has many modules to perform it's operation, before these modules can be used, they must be initialized. All the modules can be initial 2 min read Like