Search code examples
pythonpython-3.xenumsenumerationenumerate

What does enum() do in python?


I understand that enum is a class I can inherit from to make my class iterable over the objects.

But what does enum() function do, as shown in this code snippet below?

enums = [enum(domain, [], q=subdomains_queue, silent=silent, verbose=verbose) for enum in chosenEnums]
for enum in enums:
    enum.start()
for enum in enums:
    enum.join()

Solution

  • enum is not a class you can inherit from; Enum in the enum module is (see the documentation).

    The enum() in the code you are describing is a callable object that has previously been put into the list chosenEnums. We can't tell you what it is, or does, without the rest of the code.