Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!txtfeed1.tudelft.nl!tudelft.nl!txtfeed2.tudelft.nl!amsnews11.chello.com!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.007 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'mrab': 0.04; 'subject:object': 0.07; 'bind': 0.09; 'foo': 0.09; 'mon,': 0.15; '__init__': 0.16; 'occurs,': 0.16; 'wrote:': 0.16; 'instance': 0.18; 'jan': 0.19; 'cheers,': 0.20; "doesn't": 0.22; 'header:In- Reply-To:1': 0.22; 'globally': 0.23; 'pm,': 0.26; 'all,': 0.27; 'message-id:@mail.gmail.com': 0.28; 'seem': 0.29; 'class': 0.29; 'exist.': 0.30; 'line:': 0.30; "can't": 0.32; 'to:addr:python- list': 0.33; 'there': 0.33; 'received:209.85.212': 0.34; 'calling': 0.34; 'issue': 0.35; 'but': 0.37; 'received:google.com': 0.37; 'received:209.85': 0.38; 'either': 0.39; 'received:209': 0.39; 'subject:: ': 0.39; 'to:addr:python.org': 0.40; 'your': 0.61; "'foo'": 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=z93o/mAb1fyaL7ZlQfo4FUJYwBLH4fwjSMm0jhpGGZs=; b=cSqFJTsoik4hx63I68OS+eync+JhB84WTMM8QG/HQMS6U1UPTmGzTp60QhmIDyJ3PC 6fJMfMZnZxs+PsTGbpbkliY96/G1RdSMUy4y6InbizVdMdC0UFzZ+ac4fPRK7K4UZPtA 1rvXVFoO3CFgXWjHdxYcFXtBERNfsOBE6B8mc= MIME-Version: 1.0 In-Reply-To: <4F1DC9EA.7010603@mrabarnett.plus.com> References: <4F1DC9EA.7010603@mrabarnett.plus.com> From: Ian Kelly Date: Mon, 23 Jan 2012 14:21:53 -0700 Subject: Re: Using an object inside a class To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 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: 18 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1327353746 news.xs4all.nl 6931 [2001:888:2000:d::a6]:36493 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:19288 On Mon, Jan 23, 2012 at 1:58 PM, MRAB wrote: >> Either way would work but the main issue is I can't seem to use foo or >> foo.bar or foo.bar.object anywhere in __init__ or even before that in >> the main class area. >> > This line: > > foo = MyApp(0) > > will create a 'MyApp' instance and then bind it to the name 'foo'. > Until that binding occurs, the name 'foo' doesn't exist. What MRAB said; also note that there is no need to bind your wx.App instance to a name at all, because you can retrieve it globally by calling wx.GetApp(). Cheers, Ian