If you take the following simple class:
class AltString:
def __init__(self, str = "", size = 0):
self._contents = str
self._size = size
self._list = [str]
def append(self, str):
self._list.append(str)
def output(self):
return "".join(self._list)
And I successfully invoke the class instance using:
as = AltString("String1")
as.append("String2")
as.append("String3")
When I then invoke the output function using as.output instead of a string being returned, I get the following instead:
unbound method AltString.output
if I call it using as.output() I get the following error:
TypeError: unbound method output() must be called with
AltString instance as first argument (got nothing instead)
What I am not doing right?
StringIO.StringIOclass.as.output(). The error message is probably from doingAltString.output().