No. and No.
And Challenge Accepted. Let me be clear. I am not challenging YOU. I am challenging myself because I don't see what you are seeing.
In many cases, context handling is better described together
rather than splitting it into __enter__
and __exit__
.
In my view, transaction_pubevents is a good example.
I don't see it...
This is why I used the word "propose". And you're absolutely correct that the burden of proof is now on me. I humbly accept the challenge.
If I find that @contextmanager decorator is easier to understand in this situation than than contextlib.AbstractContextManager, then it's only a personal preference and I'll be quiet.
I really like how @davisagli put it:
They are functionally equivalent and you have to understand both to read Python code.
The burden is on me to understand both.
However, this files counter to the proposition "there should be one and only one obvious way to do it" (and I know that's a poke at Larry Wall, but I like the philosophy because I can't read my own perl). I only --think-- I understand both, but to be sure, I must accept the challenge proposed by @dieter.
Additionally:
I do not use "youtoube" (and variants). Therefore, I did not watch it.
To which I reply:
"There is a principle which is a bar against all information, which is proof against all arguments and which can not fail to keep a man in everlasting ignorance-that principle is contempt prior to investigation."
--HERBERT SPENCER
But this is just a jab. It's forcing You @dieter to absorb knowledge the same way I @flipmcf do. And this is not fair.
I don't learn well from reading. Maybe you do. So, here is the text of the video, so you don't have to "click"
November 9, 1964 Dr. Richard Feynman "Seeking New Laws" by Richard Feynman speech transcript
Now another thing that people often say is that for guessing, two identical theories– two theories. Suppose you have two theories, a and b, which look completely different psychologically. They have different ideas in them and so on. But that all the consequences that are computed, all the consequences that are computed are exactly the same. You may even say they even agree with experiment.
The point is thought that the two theories, although they sound different at the beginning, have all consequences the same. It’s easy, usually, to prove that mathematically, by doing a little mathematics ahead of time, to show that the logic from this one and this one will always give corresponding consequences.
Suppose we have two such theories. How are we going to decide which one is right? No way, not by science. Because they both agree with experiment to the same extent, there’s no way to distinguish one from the other.
So two theories, although they may have deeply different ideas behind them, may be mathematically identical. And usually people say, then, in science one doesn’t know how to distinguish them. And that’s right.
However, for psychological reasons, in order to guess new theories, these two things are very far from equivalent. Because one gives a man different ideas than the other. By putting the theory in a certain kind of framework, you get an idea of what to change, which would be something, for instance, in theory A that talks about something. But you say I’ll change that idea in here.
But to find out what the corresponding thing you’re going to change in here may be very complicated. It may not be a simple idea. In other words, a simple change here, may be a very different theory than a simple change there.
In other words, although they are identical before they are changed, there are certain ways of changing one which look natural, which don’t look natural in the other. Therefore, psychologically, we must keep all the theories in our head.
And every theoretical physicist that’s any good knows six or seven different theoretical representations for exactly the same physics, and knows that they’re all equivalent, and that nobody’s ever going to be able to decide which one is right at that level. But he keeps them in his head, hoping that they’ll give him different ideas for guessing.
Incidentally, that reminds me of another thing. And that is that the philosophy, or the ideas around the theory– a lot of ideas, you say, I believe there is a space time, or something like that, in order to discuss your analyses– that these ideas change enormously when there are very tiny changes in the theory.
In other words, for instance, Newton’s idea about space and time agreed with experiment very well. But in order to get the correct motion of the orbit of Mercury, which was a tiny, tiny difference, the difference in the character of the theory with which you started was enormous. The reason is these are so simple and so perfect. They produce definite results.
In order to get something that produced a little different result, it has to be completely different. You can’t make imperfections on a perfect thing. You have to have another perfect thing.
This is a conflict. It's my conflict. Conflicts aren't 'bad', they are just an opportunity to better understand ourselves and others. If I come off arrogant and mean, it's only because I'm proposing truths, not actually committing to them.
And I'm too much a coward to bring this up on a python forum. I feel comfortable in Plone exposing my ignorance. I'll get there some day, maybe.