News for hackers. Stuff that matters.
Re:Please fix your Python decorators by jdmichal on Monday August 01, 2016 @05:52PM (#12206337)
Define a function to do the same and call that at the end of every method? These don't seem that different to me:

    def doStuff():
        # do stuff
        return checkError(value)

    @checkError
    def doStuff():
        # do stuff
        return value
EDIT: In fact, I think the above succinctly hits on lotsoflumens' point. The latter clearly obfuscates the fact that an error check is performed behind the decorator. The former makes it very clear that something is happening to the return value before it leaves.

There are no comments on this comment yet.