On Wed, Jan 7, 2009 at 9:45 AM, prasad rao <prasadarao...@gmail.com> wrote:

> hello
> Sorry to interject.
> This class seems asymmetric.
> Class Value:
>     def __init__(self,inte='',stri=''):
>           self.inte=inte
>           self.stri=stri
>     def setvalue(inte='',stri=''):
>          self.stri=str(self.inte)
>          self.int=int(self.stri)
> I tried. But failed.What is wrong with above code?
>
>  >>> Class Value:
>       def __init__(self,inte='',stri=''):
>           self.inte=inte
>           self.stri=stri
>       def setvalue(inte='',stri=''):
>          self.stri=str(self.inte)
>          self.int=int(self.stri)
>
> SyntaxError: invalid syntax

'class' should not start with a capital. I do by the way wonder what
your code is supposed to accomplish - why have arguments inte and stri
for setvalue when you don't use them (you use the existing value of
self.stri).



-- 
André Engels, andreeng...@gmail.com
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to