Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.026 X-Spam-Evidence: '*H*': 0.95; '*S*': 0.00; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:80.91.229.12': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'received:lo.gmane.org': 0.09; 'am,': 0.12; 'attribute:': 0.16; 'magic.': 0.16; 'wrote:': 0.18; 'dec': 0.22; 'header:In-Reply- To:1': 0.22; 'subject:" ': 0.28; 'explicit': 0.29; 'pm,': 0.29; 'class': 0.29; 'definition': 0.30; 'tue,': 0.32; 'header:User- Agent:1': 0.33; 'header:X-Complaints-To:1': 0.33; 'to:addr:python- list': 0.34; 'eric': 0.34; 'approach.': 0.34; 'received:au': 0.36; 'subject:with': 0.36; 'but': 0.37; 'received:org': 0.38; 'being': 0.39; 'subject: (': 0.40; 'to:addr:python.org': 0.40; 'more': 0.61; '2011': 0.61; 'your': 0.61; '03:56': 0.84; 'snow': 0.91; 'received:110': 0.95 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Lie Ryan Subject: Re: AttributeError in "with" statement (3.2.2) Date: Thu, 15 Dec 2011 06:14:19 +1100 References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: 110-175-240-90.static.tpgi.com.au User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:8.0) Gecko/20111124 Thunderbird/8.0 In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 12 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1323890081 news.xs4all.nl 6877 [2001:888:2000:d::a6]:57678 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:17229 On 12/15/2011 03:56 AM, Eric Snow wrote: > On Tue, Dec 13, 2011 at 11:05 PM, Eric Snow 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