enum.auto() in Python Last Updated : 12 Sep, 2024 Comments Improve Suggest changes Like Article Like Report With the help of enum.auto() method, we can get the assigned integer value automatically by just using enum.auto() method. Syntax : enum.auto()Automatically assign the integer value to the values of enum class attributes.Example #1 : In this example we can see that by using enum.auto() method, we are able to assign the numerical values automatically to the class attributes by using this method. Python # import enum and auto from enum import Enum, auto # Using enum.auto() method class language(Enum): Java = auto() Python = auto() HTML = auto() print(list(language)) Output[<language.Java: 1>, <language.Python: 2>, <language.HTML: 3>] Example #2 : Python # import enum and auto from enum import Enum, auto # Using enum.auto() method class language(Enum): Cpp = auto() JavaScript = auto() Java = auto() Python = auto() HTML = auto() print(list(language)) Output[<language.Cpp: 1>, <language.JavaScript: 2>, <language.Java: 3>, <language.Python: 4>, <language.HTML: 5>] Comment More infoAdvertise with us Next Article enum.auto() in Python J jitender_1998 Follow Improve Article Tags : Python Python-enum Practice Tags : python Similar Reads Python Main Function Main function is like the entry point of a program. However, Python interpreter runs the code right from the first line. The execution of the code starts from the starting line and goes line by line. It does not matter where the main function is present or it is present or not. Since there is no mai 5 min read anext() in Python anext() is a built-in function that retrieves the next item from an asynchronous iterator, acting as the async version of next(). It is essential when working with async iterators and generators, offering more flexibility in asynchronous workflows. Note: anext() is available starting in Python 3.10. 3 min read dir() function in Python The dir() function is a built-in Python tool used to list the attributes (like methods, variables, etc.) of an object. It helps inspect modules, classes, functions, and even user-defined objects during development and debugging.Syntaxdir([object])Parameters: object (optional): Any Python object (lik 3 min read __init__ in Python Prerequisites - Python Class and Objects, Self__init__ method in Python is used to initialize objects of a class. It is also called a constructor. It is like a default constructor in C++ and Java. Constructors are used to initialize the objectâs state.The task of constructors is to initialize (assig 5 min read __call__ in Python Python has a set of built-in methods and __call__ is one of them. The __call__ method enables Python programmers to write classes where the instances behave like functions and can be called like a function. When this method is defined, calling an object (obj(arg1, arg2)) automatically triggers obj._ 4 min read Like