> The semantic change actually needed to make nested() more equivalent to > the multi-with statement is for it to accept zero-argument callables > that create context managers as arguments rather than pre-created > context managers.
It seems to me that both passing callables which return managers and passing a generator which yields managers achieve about the same thing. Are you proposing the former just to avoid introducing a new interface? > Rather than changing the name of the function, this could be done by > inspecting the first argument for an "__enter__" method. If it has one, > use the old semantics (and issue a DeprecationWarning as in 3.1). > Otherwise, use the proposed new semantics. I guess this is much too late for 3.1, but could we then at least un-deprecate "contextlib.nested" for now? As it is, you get a DeprecationWarning for something like with contextlib.nested(*my_managers): without any good way to get rid of it. - Hagen _______________________________________________ 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