Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
SADAVA5557yit could be:
- just for practice
- easily reusable/extendable code
- for further code split in blocks like methods/functions/data etc. -
dayo30537yAbstracting code like this can be really useful in the long run. Me and a work colleague are currently re coding a web application as nothing was abstracted. If you wanted to edit something you had to do it in 50 places.
Just think what happens if you now have to support multiple languages. Rather then editing one function you now have to edit everywhere where you print. -
Short code isn't necessarily better
In this case I'd suggest the first snippet is better, assuming they're using that decorator more than once, although I would argue it could be better to make a function to print a decorated string
Related Rants
Don’t you hate it when people completly overcomplicates code?
The bottom one is my edit of the code.
rant
overcomplication
stupid people
code