Re: Unexpected behavior using contextmanager on a class method

2012-08-07 Thread Steven D'Aprano
On Tue, 07 Aug 2012 08:30:15 -0700, Thomas Draper wrote: > I want to use with..as in a "reversible circuit generator". However, it > seems that @contextmanager changes the expected nature of the class. I > tried to distill the problem down to a simple example. Nothing to do with contextmanager. T

Re: Unexpected behavior using contextmanager on a class method

2012-08-07 Thread Peter Otten
Thomas Draper wrote: > I want to use with..as in a "reversible circuit generator". However, it > seems that @contextmanager changes the expected nature of the class. I > tried to distill the problem down to a simple example. > > import contextlib > > class SymList: The problem you experience ha

Unexpected behavior using contextmanager on a class method

2012-08-07 Thread Thomas Draper
I want to use with..as in a "reversible circuit generator". However, it seems that @contextmanager changes the expected nature of the class. I tried to distill the problem down to a simple example. import contextlib class SymList: def __init__(self, L=[]): self.L = L @contextli