[Python-ideas] __before__ and __after__ attributes for functions

Chris Angelico rosuav at gmail.com
Thu Jan 23 16:12:41 CET 2014


On Fri, Jan 24, 2014 at 2:08 AM, Antoine Pitrou <solipsis at pitrou.net> wrote:
>     # XXX should the "after" function also receive the return value?

That's a possible consideration, but it messes up the "has the same
arguments" bit. Plus, what happens to the after function(s) if the
main function throws an error? (And what happens to the main if a
before function bombs?) Very hard to solve in the general case, which
is a good reason for this NOT to go into the stdlib, but just to be
implemented whenever it's wanted.

ChrisA


More information about the Python-ideas mailing list