Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #19290
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <ian.g.kelly@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.003 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'subject:object': 0.07; 'called.': 0.09; 'foo': 0.09; 'cc:addr:python-list': 0.15; 'mon,': 0.15; '__init__': 0.16; 'assigns': 0.16; 'happens.': 0.16; 'returned,': 0.16; 'tab,': 0.16; 'wrote:': 0.16; 'exists': 0.18; 'instance': 0.18; 'yet.': 0.18; 'jan': 0.19; 'cheers,': 0.20; 'suggest': 0.20; 'later': 0.21; 'cc:no real name:2**0': 0.21; 'header:In-Reply-To:1': 0.22; 'obviously': 0.23; 'somehow': 0.23; 'defined': 0.24; 'cc:2**0': 0.25; 'process,': 0.25; 'pm,': 0.26; 'function': 0.27; 'message-id:@mail.gmail.com': 0.28; 'cc:addr:python.org': 0.29; 'seem': 0.29; '(the': 0.30; 'actually': 0.32; 'assigned': 0.32; 'creates': 0.34; 'received:209.85.212': 0.34; 'purely': 0.34; 'then.': 0.34; 'running': 0.35; 'instead.': 0.36; 'push': 0.36; 'reference': 0.37; 'received:google.com': 0.37; 'using': 0.37; 'happens': 0.37; 'references': 0.38; 'received:209.85': 0.38; "what's": 0.39; 'strong': 0.39; 'called': 0.39; 'received:209': 0.39; 'subject:: ': 0.39; 'presented': 0.62; "'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 :cc:content-type; bh=1CpTNE0oaEcKYe/ZD00SvIw8qLZORnwDrRpsIlAHwrE=; b=ivhnH5qnFhjLeZwX/1vPLfiPFju9l04vDJ/Nxj+m4YGkvJrYVIvCQ4t951F0KoSNOx POFJw6rK1hobWHGEIxix3ApV7m16TBkuwPnq+Hn96Ss8AH5IJ/FMuzvJ4aCLuGU5f6Cv X8QXNAqF868SPn2PWM14jKrFLKgYMSNEScR6c= |
| MIME-Version | 1.0 |
| In-Reply-To | <CAGz2ECYB=__eKdhdbgWDzRY2DSW4ZcFzuobQCMJFPogV0hcOJA@mail.gmail.com> |
| References | <CAGz2ECYwdnB2ZoTo-DXHhO1_MzdjWeYB+nxeNJ+xivPa8N-tVA@mail.gmail.com> <jfkfn3$92a$1@dough.gmane.org> <CAGz2ECYB=__eKdhdbgWDzRY2DSW4ZcFzuobQCMJFPogV0hcOJA@mail.gmail.com> |
| From | Ian Kelly <ian.g.kelly@gmail.com> |
| Date | Mon, 23 Jan 2012 14:42:43 -0700 |
| Subject | Re: Using an object inside a class |
| To | Jonno <jonnojohnson@gmail.com> |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Cc | python-list@python.org |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.4989.1327354997.27778.python-list@python.org> (permalink) |
| Lines | 23 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1327354997 news.xs4all.nl 6971 [2001:888:2000:d::a6]:41227 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:19290 |
Show key headers only | View raw
On Mon, Jan 23, 2012 at 2:22 PM, Jonno <jonnojohnson@gmail.com> wrote: >> References inside functions are resolved when the function is called. So >> purely from what you have presented above, it would seem that 'foo' is >> defined between the call to __init__ and a later call to method1. > > > I have a strong suspicion that this is what's happening. > > Method1 is called on a button push when MainLoop is running so obviously foo > (the main wx.App) exists by then. > I must have somehow be initializing Class1 before foo = MyApp() happens. Exactly. The line "app = MyApp(0)" creates a MyApp instance and then assigns it to "app". As part of the MyApp creation process, it creates a MyFrame, which creates a Tab, which creates a Class1, which attempts to reference "app". All of this happens before that "MyApp(0)" call has returned, so the result of that call has not actually been assigned to "app" yet. I suggest using wx.GetApp() instead. Cheers, Ian
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Using an object inside a class Ian Kelly <ian.g.kelly@gmail.com> - 2012-01-23 14:42 -0700
csiph-web