[Python-Dev] Possible context managers in stdlib
Phillip J. Eby
pje at telecommunity.com
Fri Jul 8 23:02:33 CEST 2005
At 10:24 PM 7/8/2005 +0200, Reinhold Birkenfeld wrote:
> with sys.trace
Note that it's currently not possible to inspect the trace/profile hooks
from Python code, only from C, so that might be, um, interesting to implement.
>* pprint: with pprint.printer (used for print)
Interesting; I'm not sure if I like it.
>* os: with os.current_directory
What does this do? Oh, I get it. The name's not very obvious. I would've
expected a more imperative name, something like 'with os.setcwd()' or 'with
os.pushdir()'.
> with os.modified_env
> with os.umask/uid/gid etc.
Yeah, again I would expect more verbish names, but these are at least
easier to grasp than current_directory was.
>* curses: with curses.wrapper
> with logging.Logger
>* tty: with tty.raw
> with tty.cbreak
>* cgitb: with cgitb.enabled
What do these do?
More information about the Python-Dev
mailing list