Python Programming - Decorators - Discussion

Discussion Forum : Decorators - General Questions (Q.No. 27)
27.
What does the @functools.cmp_to_key decorator do?
Converts a method to a class method
Enables the use of the 'with' statement for resource management
Converts an old-style comparison function to a key function
Marks a method as a static method
Answer: Option
Explanation:
The @functools.cmp_to_key decorator is used to convert an old-style comparison function to a key function, making it compatible with functions that require a key for comparison.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.