[Python-Dev] PEP 343 and __context__()
jason.orendorff at gmail.com
Fri Jan 20 04:41:23 CET 2006
I just noticed that my name is in PEP 343 attached to the idea of the
__context__() method, and I'm slightly queasy over it.
The rationale was to help e.g. decimal.DecimalContext support 'with'.
Maybe that's a bad idea.
DecimalContext has a few problems. In code where it matters, every
function you write has to worry about it. (That is, you can't just
write __decimal_context__ = ... at the top of the file and be done
with it, the way you can with, say, __metaclass__.) And
DecimalContext doesn't fit in with generators.
sys.stdout has similar problems.
It feels like PEP 343 will make people want to follow this model.
That is, we'll see more global behavior-controlling variables in the
future. There are grizzlier fates; I just wondered if anyone had
thought of this.
More information about the Python-Dev