Article View: alt.free.newsservers
Article #100213Re: Self in Interactive Interpreter
From: Tony
Date: Fri, 04 Apr 2008 05:59
Date: Fri, 04 Apr 2008 05:59
45 lines
2400 bytes
2400 bytes
Yes i was annoyed by the same thing just a few weeks ago. kj7ny wrote: > Hope this hasn't been posted hundreds of times. I have never seen it > before, but could have missed it. > > For years it has been a slight annoyance that every time I wanted to > test a snippet of code from a class by running it in the interactive > interpreter, I had to remove all of the self. instances from the > code. After I got it working correctly, I had to put all the self.'s > back into the code to put it back into my class. > > The other day my brain had a functional synapse and I realized I could > just start my interactive session with: > > >>> class dummy: > >>> def __init__(self): > >>> pass > >>> > >>> self=dummy() > > I could then just set up my test variables something like: > > >>> self.x='Hello ' > >>> self.y='World' > > And I could then use class type code such as: > > >>> print self.x, self.y > > I no longer had to remove and then replace all of the self. notation > from my code snippets. > > So far I haven't seen why I shouldn't to this. I haven't had any > problems using it, but I haven't used it that much. If there is a > good reason to NOT do it, let me know. Otherwise I hope this helps > anyone who has been annoyed by the same thing. > > Thanks, -- Regards Tony... Making usenet better for everyone everyday
Technical Details
Message-ID:
<47F5C3BB.651D57BD@TheDeli.Sandwich>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-alt.free.newsservers.20150605.mbox.gz!number1.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsfeed.straub-nv.de!aioe.org!not-for-mailReferences:
<82f7102e-c2f9-4e9a-a26a-a6e2ba5453da@i12g2000prf.googlegroups.com>Show Full Headers
Complete Article Headers
Message-ID: <47F5C3BB.651D57BD@TheDeli.Sandwich> Subject: Re: Self in Interactive Interpreter Date: Fri, 04 Apr 2008 01:59:23 -0400 From: Tony <Tony@TheDeli.Sandwich> References: <82f7102e-c2f9-4e9a-a26a-a6e2ba5453da@i12g2000prf.googlegroups.com> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-alt.free.newsservers.20150605.mbox.gz!number1.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsfeed.straub-nv.de!aioe.org!not-for-mail Newsgroups: alt.free.newsservers Organization: Sultans Of CyberFROG Lines: 45 NNTP-Posting-Host: 9JBfVd7mbEcHGiC/2AkzDA.user.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org X-Mailer: Mozilla 4.8 [en] (Windows NT 5.0; U) X-Accept-Language: en