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
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
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!
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 +
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
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
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
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
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
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
10 matches
Mail list logo