Python Decorators and Generators Q & A: Day 5 Live Session Review

K21Academy
1 min readNov 6, 2021

Generators
Generators are just like functions that give us a sequence of values one as an iterable (which can be iterated upon using loops). Generators contain yield statements just as functions contain return statements.

Generator functions return a generator object. Generator objects are used either by calling the next method on the generator object or using the generator object in a “for in” loop.

Decorators
Decorators are a very powerful and useful tool in Python since it allows programmers to modify the behavior of function or class.

Decorators allow us to wrap another function in order to extend the behavior of the wrapped function, without permanently modifying it.

To know more about these Python Generators & Decorators covered in our Day 5 session check my blog at: https://k21academy.com/pythonday5

Join our FREE CLASS waitlist at https://k21academy.com/python02 for Python For Data Science (AI/ML) & Data Engineers and get notified.

--

--

K21Academy

K21Academy is #1 Cloud Training marketplace accredited with Oracle Gold Partners, Silver Partners of Microsoft and Registered DevOps Partners.