Re: Need help to pass self.count to other classes.

2010-01-08 Thread Lie Ryan
On 1/8/2010 3:56 PM, Steven D'Aprano wrote: Unfortunately this won't do what you expect, because sys.ps1 and ps2 should be either strings, or objects with a __str__ method. They aren't called to generate the prompt. but their __str__ does get called to generate the prompt. import sys class kb

Re: Need help to pass self.count to other classes.

2010-01-08 Thread Peter Otten
Steve Holden wrote: > Steven D'Aprano wrote: > [... points out my misapprehension ...] >> > kbi = kbInterface() > sys.ps1 = kbi.prompt1 >> > 0xb7cbd52c>>print "Hello" >> Hello >> > 0xb7cbd52c>> >> > Right, this is expert mode ... Here's a way to turn expert mode into something less adva

Re: Need help to pass self.count to other classes.

2010-01-08 Thread Steve Holden
Steven D'Aprano wrote: [... points out my misapprehension ...] > kbi = kbInterface() sys.ps1 = kbi.prompt1 > 0xb7cbd52c>>print "Hello" > Hello > 0xb7cbd52c>> > Right, this is expert mode ... regards Steve -- Steve Holden +1 571 484 6266 +1 800 494 3119 PyCon is coming!

Re: Need help to pass self.count to other classes.

2010-01-07 Thread Steven D'Aprano
On Wed, 06 Jan 2010 08:56:23 -0500, Steve Holden wrote: > This is untested code (some days I don't seem to write any other kind > ...) but it should give you the flavor: > > class kbInterface(object): > def __init__(self): > self.zxc = 0 > def prompt1(self): > self.count +

Re: Need help to pass self.count to other classes.

2010-01-06 Thread Steve Holden
Bruno Desthuilliers wrote: > Steve Holden a écrit : > (snip) >> This is untested code > > indeed !-) > >> class kbInterface(object): >> def __init__(self): >> self.zxc = 0 >> def prompt1(self): >> self.count += 1 > > Ahem... > > (snip) > > Caveat emptor ... this code i

Re: Need help to pass self.count to other classes.

2010-01-06 Thread Bruno Desthuilliers
Steve Holden a écrit : (snip) This is untested code indeed !-) class kbInterface(object): def __init__(self): self.zxc = 0 def prompt1(self): self.count += 1 Ahem... (snip) -- http://mail.python.org/mailman/listinfo/python-list

Re: Need help to pass self.count to other classes.

2010-01-06 Thread Steve Holden
Bill wrote: > After a year with Python 2.5 on my Windows box, I still have trouble > understanding classes. > > Below, see the batch file and the configuration script for > my Python interactive prompt. > > The widths of the secondary prompts increase when the self.count of > SysPrompt1 exceeds

Re: Need help to pass self.count to other classes.

2010-01-06 Thread Bruno Desthuilliers
Bill a écrit : After a year with Python 2.5 on my Windows box, I still have trouble understanding classes. Below, see the batch file and the configuration script for my Python interactive prompt. The widths of the secondary prompts increase when the self.count of SysPrompt1 exceeds 99. I am u

Re: Need help to pass self.count to other classes.

2010-01-06 Thread Francesco Bochicchio
On 6 Gen, 11:11, Bill wrote: > After a year with Python 2.5 on my Windows box, I still have trouble > understanding classes. > > Below, see the batch file and the configuration script for > my Python interactive prompt. > > The widths of the secondary prompts increase when  the self.count of > Sys

Need help to pass self.count to other classes.

2010-01-06 Thread Bill
After a year with Python 2.5 on my Windows box, I still have trouble understanding classes. Below, see the batch file and the configuration script for my Python interactive prompt. The widths of the secondary prompts increase when the self.count of SysPrompt1 exceeds 99. I am using a global var