Re: [Tutor] try and except

2009-12-31 Thread Dave Angel
spir wrote: Lie Ryan dixit: class Error(Exception): def __init__(self, value): self.value = value def printer(self, value): print self.value You can also use __str__ instead of printer. This will give a standard output form for your error automatically use

Re: [Tutor] try and except

2009-12-30 Thread Kent Johnson
On Wed, Dec 30, 2009 at 8:39 AM, spir wrote: > Lie Ryan dixit: > >> class Error(Exception): >>      def __init__(self, value): >>          self.value = value >>      def printer(self, value): >>          print self.value > > You can also use __str__ instead of printer. This will give a standard ou

Re: [Tutor] try and except

2009-12-30 Thread spir
Lie Ryan dixit: > class Error(Exception): > def __init__(self, value): > self.value = value > def printer(self, value): > print self.value You can also use __str__ instead of printer. This will give a standard output form for your error automatically used by print and

Re: [Tutor] try and except

2009-12-29 Thread Lie Ryan
On 12/30/2009 7:47 AM, Grigor Kolev wrote: Hi. Can someone explain me where is my mistake. --- class Error(Exception): def printer(self , value ): self.value = value print self.value def oops(): raise Erro

Re: [Tutor] try and except

2009-12-29 Thread Hugo Arts
On Tue, Dec 29, 2009 at 9:47 PM, Grigor Kolev wrote: > Hi. > Can someone explain me where is my mistake. > --- > class Error(Exception): >        def printer(self , value ): >                self.value = value >                print self.value > def oops

[Tutor] try and except

2009-12-29 Thread Grigor Kolev
Hi. Can someone explain me where is my mistake. --- class Error(Exception): def printer(self , value ): self.value = value print self.value def oops(): raise Error def domoed(): try: