Re: Inheriting str object

2007-02-06 Thread Alejandro Barroso
On 5 feb, 11:48, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > I want to have a str with custom methods, but I have this problem: > > class myStr(str): > def hello(self): > return 'hello '+self > > s=myStr('world') > print s.hello() # prints 'hello world' > s=s.upper() > print s.hell

Re: Inheriting str object

2007-02-05 Thread BJörn Lindqvist
On 5 Feb 2007 02:48:08 -0800, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I want to have a str with custom methods, but I have this problem: > > class myStr(str): > def hello(self): > return 'hello '+self > > s=myStr('world') > print s.hello() # prints 'hello world' > s=s.upper() > p

Re: Inheriting str object

2007-02-05 Thread Virgil Dupras
On Feb 5, 5:48 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > I want to have a str with custom methods, but I have this problem: > > class myStr(str): > def hello(self): > return 'hello '+self > > s=myStr('world') > print s.hello() # prints 'hello world' > s=s.upper() > print s.he

Re: Inheriting str object

2007-02-05 Thread Benjamin Niemann
Marc 'BlackJack' Rintsch wrote: > In <[EMAIL PROTECTED]>, > [EMAIL PROTECTED] wrote: > >> I want to have a str with custom methods, but I have this problem: >> >> class myStr(str): >> def hello(self): >> return 'hello '+self >> >> s=myStr('world') >> print s.hello() # prints 'hello

Re: Inheriting str object

2007-02-05 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, [EMAIL PROTECTED] wrote: > I want to have a str with custom methods, but I have this problem: > > class myStr(str): > def hello(self): > return 'hello '+self > > s=myStr('world') > print s.hello() # prints 'hello world' > s=s.upper() > print s.hello() # expect

Inheriting str object

2007-02-05 Thread [EMAIL PROTECTED]
I want to have a str with custom methods, but I have this problem: class myStr(str): def hello(self): return 'hello '+self s=myStr('world') print s.hello() # prints 'hello world' s=s.upper() print s.hello() # expected to print 'hello WORLD', but s is no longer myStr, it's a regular st