+ 8

why do we use decorators and I really don't understand this properties ! could anyone explain it

26th Jun 2016, 4:55 PM
ishwarya lakshmi
7 Respostas
+ 6
It lets you write smaller, more reusable functions. You can write a whole program as one function, but that is a terrible idea. Likewise, small functions are generally better than large ones. Using decorators is one way you can split a function that does two things, that prints text and prints a border, into two functions -- one that prints text and one that wraps printed text in a border.
22nd Jul 2016, 7:41 PM
genelogic
+ 2
Here is an example of what a decorator may be useful for: https://code.sololearn.com/cD09ijlIS6Ev/?ref=app
25th Mar 2018, 4:33 PM
Denys Yeromenko
Denys Yeromenko - avatar
0
As someone writing a MUD, decorators could be handy for outputting texts like articles within decorated boundaries.
27th Aug 2016, 9:07 AM
Orest Bee
Orest Bee - avatar
0
answer plz?
9th Feb 2017, 10:49 AM
keerthana
keerthana - avatar
- 3
to spice up our functions
7th Jul 2016, 8:15 AM
Naser Miiya
Naser Miiya - avatar
- 4
it just a way to extend any function's functionality without actually updating it...
27th Jun 2016, 9:19 AM
Naresh Chaudhary
- 6
Save memory
27th Jun 2016, 6:55 AM
sennheisermx500 sennheisermx500
sennheisermx500 sennheisermx500 - avatar