[Python-ideas] Bad programming style in decorators?

u8y7541 The Awesome Person surya.subbarao1 at gmail.com
Sat Jan 2 13:14:55 EST 2016


In most decorator tutorials, it's taught using functions inside functions.
Isn't this inefficient because every time the decorator is called, you're
redefining the function, which takes up much more memory? I prefer defining
decorators as classes with __call__ overridden. Is there a reason why
decorators are taught with functions inside functions?

-- 
-Surya Subbarao
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20160102/f0da6299/attachment.html>


More information about the Python-ideas mailing list