资讯

In the example above, the calculate_squares function didn’t need any parameters, but what if we wanted to make our log_performance decorator work with any function that takes any parameters?
Decorators in Python are a prime-time example of a perfectly implemented feature. It does take a while to wrap your head around, but it’s worth it.