AttributeError in "with" statement (3.2.2)
Lie Ryan
lie.1296 at gmail.com
Wed Dec 14 14:14:19 EST 2011
On 12/15/2011 03:56 AM, Eric Snow wrote:
> On Tue, Dec 13, 2011 at 11:05 PM, Eric Snow<ericsnowcurrently at gmail.com> wrote:
>
> If you want to be more dynamic about it you can do it, but it involves
> black magic. Chances are really good that being explicit through your
> class definition is the right approach.
Note that the black spice is to use the __class__ attribute:
foo.__class__.__exit__ = foo.goodbye
More information about the Python-list
mailing list