A Plus Topper interview question

What is decorators and generators

Interview Answer

Anonymous

22 Nov 2021

Decorators are as the name tells itself, designed callabel objects that are "decorating" the function or class that it's added. They can be usefull when we don't want to change a class or a function but still want to change it is behavior in a some way. Generators are essentialy generating machines, instead of generating something at one shot; they are partially generating things so we can free some memories or make a task faster.

1