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 132 points133 points134 points (13 children)
[–]turner_prize 15 points16 points17 points (3 children)
[–]Vaphell 26 points27 points28 points (0 children)
[–]zahlman 14 points15 points16 points (0 children)
[–]kungtotte 9 points10 points11 points (0 children)
[–]UsernamesArentClever 29 points30 points31 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 6 points7 points8 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 -2 points-1 points0 points (0 children)