🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Python Decorators: all 10 questions

Quiz: Python Decorators · Question 9 of 10

Which standard-library decorator remembers results so repeated calls are fast?

Which standard-library decorator remembers results so repeated calls are fast?

  1. A.@staticmethod
  2. B.@property
  3. C.@functools.wraps
  4. D.@functools.lru_cache
Answer & explanation

Correct answer: @functools.lru_cache

lru_cache stores results for each argument and returns them from the cache.

Can you get the rest right without peeking?

Take the timed Quiz: Python Decorators quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →