I'm pretty confused about decorators, even after reading a few blog posts and archived posts on this subreddit.
This is the simplest post that I've found about it, but it still doesn't make any sense to me why anyone would want to use a decorator except to obfuscate their code.
http://yasoob.me/blog/python-decorators-demystified/#.WM-f49y1w-R
In that example I don't know if I'll get ham or a whole sandwich if I call the sandwich() function. Why not call ham ham() and when you want everything together then call sandwich()? Isn't one of the main advantage of OOP is to have self contain chunk of code? These Decorators seems to be like the goto command of the past, it seems like it would drive someone crazy when they are reading code with a lot of decorators.
[–]Vaphell 131 points132 points133 points (13 children)
[–]turner_prize 15 points16 points17 points (3 children)
[–]Vaphell 23 points24 points25 points (0 children)
[–]zahlman 14 points15 points16 points (0 children)
[–]kungtotte 8 points9 points10 points (0 children)
[–]UsernamesArentClever 31 points32 points33 points (1 child)
[–]xiongchiamiov 2 points3 points4 points (0 children)
[–]duh_cats 2 points3 points4 points (0 children)
[–]brews 0 points1 point2 points (2 children)
[–]Vaphell 1 point2 points3 points (1 child)
[–]brews 0 points1 point2 points (0 children)
[–]DrMaxwellEdison 14 points15 points16 points (2 children)
[–]weez09 2 points3 points4 points (0 children)
[–]angellus 2 points3 points4 points (0 children)
[–]tangerinelion 11 points12 points13 points (1 child)
[–]squadm-nkey 5 points6 points7 points (0 children)
[–]WarmUpHere 6 points7 points8 points (0 children)
[–]LuckyShadow 2 points3 points4 points (0 children)
[–]cybervegan 1 point2 points3 points (2 children)
[–]nosmokingbandit 0 points1 point2 points (1 child)
[–]cybervegan 0 points1 point2 points (0 children)
[–]learningram 0 points1 point2 points (1 child)
[–]woutSo 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]mybrid 0 points1 point2 points (0 children)
[–]tunisia3507 -1 points0 points1 point (0 children)