Why was WSGIPublisher transaction_pubevents written as a context manager?

You have a very firm understanding of all the pieces in play.

But essentially, your argument is “no true python developer would question this pattern”?

flipmcf via Plone Community wrote at 2024-2-7 04:34 +0000:

...
But essentially, your argument is “no true python developer would question this pattern”?

I argument "when you question the design of a decorated function
definition, you must not only look at the definition but also
at the decorators!"

Author:
Guido van Rossum, Alyssa Coghlan

In this PEP, context managers provide `__enter__()`
and `__exit__()` methods that are invoked on 
entry to and exit from the body of the with statement.

===

No true python developers?

While I agree with everything, the code in question is a very internal part of the machine here, rarely touched.

We have here two concepts to understand, both on the more advanced side.

I do not see a immediate need for change in the code. We may want to add some explaining lines to it.

2 Likes

No worries, happens to all of us from time to time.


I meant to imply that it was, most likely, just the simplest, easiest, quickest (pick any) to extract a function, decorate it and be done.

1 Like