ysj.ray <ysj....@gmail.com> added the comment:

> For 3.3, the fix could be generalised with ContextDecorator supporting a 
> documented "self._recreate" internal interface that, by default, just returns 
> self, but would be overridden in _GeneratorContextManager to actually create 
> a new instance. The custom __call__ implementation for 
> _GeneratorContextManager could then be removed.

How about directly using the existing "copy.copy()" semantics instead of 
self._recreate()? That is, call "with copy.copy(self)" instead of "with self" 
in ContextGenerator.__call__(), implement ContextGenerator.__copy__() method to 
simply return self, and implement  _GeneratorContextManager.__copy__() to 
create a copy of itself. This saves an internal interface.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue11647>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to