Re: deriving from str

2004-12-27 Thread Terry Reedy
"dataangel" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Paolo Veronelli wrote: > >> I want to add some methods to str class ,but when I change the __init__ >> methods I break into problems Immutable types cannot be changed in __init__. They are initialized in __new__, which

Re: deriving from str

2004-12-27 Thread dataangel
Paolo Veronelli wrote: I want to add some methods to str class ,but when I change the __init__ methods I break into problems class Uri(str): def __init__(self,*inputs): print inputs if len(inputs)>1: str.__init__(self,'<%s:%s>'%inputs[:2]) else:

Re: deriving from str

2004-12-23 Thread Nick Coghlan
Paolo Veronelli wrote: I want to add some methods to str class ,but when I change the __init__ methods I break into problems class Uri(str): def __init__(self,*inputs): print inputs if len(inputs)>1: str.__init__(self,'<%s:%s>'%inputs[:2]) else:

deriving from str

2004-12-23 Thread Paolo Veronelli
I want to add some methods to str class ,but when I change the __init__ methods I break into problems class Uri(str): def __init__(self,*inputs): print inputs if len(inputs)>1: str.__init__(self,'<%s:%s>'%inputs[:2])