On 7/8/05, Reinhold Birkenfeld <[EMAIL PROTECTED]> wrote: > Hi, > > I compiled a list of some possible new context managers that could be > added to the stdlib. Introducing a new feature should IMO also show > usage of it in the distribution itself. That wasn't done with > decorators (a decorators module is compiled at the moment, if I'm right), > but with context managers, there's certainly room to add some. Of course, > my list is excessive, it's only some ideas I got by flying over the stdlib > docs. >
I think that is a good point about decorators. While none of us obviously had extensive experience with decorators when they went into the language we at least knew of a couple use cases that would have been handy and it probably would have been good to have examples for people to work off of. I bet iterators have gotten more play thanks to itertools and all of the built-ins that work with them. I think having basic context managers in a stdlib module that we know for a fact that will be handy is a good idea. We should keep the list short and poignant, but we should have something for people to work off of. The ones I like below for a 'context' module are: > * builtins: with open/file > * sys: with sys.redirected_std[in|out|err] > * decimal: with decimal.Context > * os: with os.current_directory > * mutex: with mutexobj > * threading: with threading.Lock > with threading.Condition > with threading.Event > * bz2/zipfile/tarfile: with ...open -Brett _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com