On 2007-02-15, placid <[EMAIL PROTECTED]> wrote:
> Is it possible to be able to do the following in Python?
>
> class Test:
> def __init__(self):
> pass
>
> def puts(self, str):
> print str
>
> def puts(self, str,str2):
> print str,str2
>
> if __name__ == "__main__":
> t = Test()
> t.puts("hi")
> t.puts("hi","hello")
You tell us: what happened when you tried it?
And then what happens when you do this?
class Test:
def __init__(self):
pass
def puts(self, *args):
print ' '.join(args)
if __name__ == "__main__":
t = Test()
t.puts("hi")
t.puts("hi","hello")
Now an exercise for the gentle reader: change the puts method
so that this call works:
t.puts("hi",1,3.45)
--
Grant Edwards grante Yow! Yow! I'm imagining
at a surfer van filled with
visi.com soy sauce!
--
http://mail.python.org/mailman/listinfo/python-list