I think you wanted to define your test method as:
def test(self, who):
self.foo(who)
The foo method also needs a self parameter.
> --
> You received this message because you are subscribed to the Google Groups
> "Utah Python User Group" group.
> To post to this group, send email to utahp...@googlegroups.com.
> To unsubscribe from this group, send email to
> utahpython+...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/utahpython?hl=en.
>
--
Shawn
The problem is that the method takes self as the first argument. self
is an argument pointing to the instance of the object from which the
method was called. To solve your problem, just do the following:
#!/usr/bin/python
class example(object):
def foo(self, who): # defined for only 1 argument
print 'Hello', who
def test(self, who):
self.foo(who)
obj=example()
obj.test("hatem")
That will do ;-)
Kind Regards,
> --
> You received this message because you are subscribed to the Google
> Groups "Utah Python User Group" group.
> To post to this group, send email to utahp...@googlegroups.com.
> To unsubscribe from this group, send email to utahpython+...@googlegroups.com
> .
> For more options, visit this group at http://groups.google.com/group/utahpython?hl=en
> .
---
Adriano Monteiro Marques
http://www.thoughtspad.com
http://www.umitproject.org
http://blog.umitproject.org
http://www.pythonbenelux.org
"Don't stay in bed, unless you can make money in bed." - George Burns