Function aliasing in Python Last Updated : 21 Mar, 2023 Summarize Comments Improve Suggest changes Share Like Article Like Report In Python, we can give another name of the function. For the existing function, we can give another name, which is nothing but function aliasing. Function aliasing in Python In function aliasing, we create a new variable and assign the function reference to one existing function to the variable. We can verify that both the objects pointing to the same memory location using id() built-in function in Python. Example 1: Basic usage of function aliasing in Python Python3 def fun(name): print(f"Hello {name}, welcome to GeeksForGeeks!!!") cheer = fun print(f'The id of fun() : {id(fun)}') print(f'The id of cheer() : {id(cheer)}') fun('Geeks') cheer('Geeks') Output: The id of fun() : 140716797521432 The id of cheer() : 140716797521432 Hello Geeks, welcome to GeeksForGeeks!!! Hello Geeks, welcome to GeeksForGeeks!!! Explanation: In the above example, only one function is available, but we can call that function by using either fun or cheer name. Example 2: Function aliasing of custom objects Here, we have defined a class Test and a method name() to return the u_name attribute of the class. Here, we are demonstrating the usage of function aliasing on the name() method of the test object. Python3 class Test: def __init__(self): self.u_name = "user-origin" def name(self): return self.u_name # create object of Test class test = Test() # create function reference and it's alias name_fn = test.name name_fn_ref = name_fn # this will print user-origin print(name_fn()) test.u_name = "user-mod" # this will print user-mod print(name_fn_ref()) Output: user-origin user-mod Explanation: name_fn is the function reference to the name() method of the test object. name_fn_ref is the function alias of the function name_fn. After changing the attribute value of u_name the function alias also reflects the change that establishes the fact that, name_fn and name_dn_ref points to the same function. Comment More infoAdvertise with us Next Article Currying Function in Python A arijitmondal2580 Follow Improve Article Tags : Python Practice Tags : python Similar Reads Currying Function in Python Currying is a functional programming technique where a function with multiple arguments is transformed into a sequence of functions, each taking a single argument.Mathematical IllustrationIn currying, a function that takes multiple inputs is broken down into a series of single-argument functions, ea 3 min read Currying Function in Python Currying is a functional programming technique where a function with multiple arguments is transformed into a sequence of functions, each taking a single argument.Mathematical IllustrationIn currying, a function that takes multiple inputs is broken down into a series of single-argument functions, ea 3 min read First Class functions in Python First-class function is a concept where functions are treated as first-class citizens. By treating functions as first-class citizens, Python allows you to write more abstract, reusable, and modular code. This means that functions in such languages are treated like any other variable. They can be pas 2 min read Python int() Function The Python int() function converts a given object to an integer or converts a decimal (floating-point) number to its integer part by truncating the fractional part.Example:In this example, we passed a string as an argument to the int() function and printed it.Pythonage = "21" print("age =", int(age) 3 min read Python Built in Functions Python is the most popular programming language created by Guido van Rossum in 1991. It is used for system scripting, software development, and web development (server-side). Web applications can be developed on a server using Python. Workflows can be made with Python and other technologies. Databas 6 min read Python 3 - input() function In Python, we use the input() function to take input from the user. Whatever you enter as input, the input function converts it into a string. If you enter an integer value still input() function converts it into a string.Python input() Function SyntaxSyntax: input(prompt)Parameter:Prompt: (optional 3 min read Like