Newbie needs "interface"
R.Brodie at rl.ac.uk
Thu Nov 22 17:57:30 CET 2001
"Roberto Bonato" <rbonato at irisa.fr> wrote in message news:3BFD2536.7B4AFFC6 at irisa.fr...
> Sometimes I want the results to be written on the stdout,
> sometimes on a Tkinter Text widget, sometimes to a file. I feel the need
> of something like a Java Interface with a method "write" to wrap all
> such devices into.
A Java interface is a 'promise' to implement a method. In Python, just
make classes with a write method.
def write(self, input):
sys.stdout.write('DEBUG-->' + input)
t = T()
print >> t, (1,2),
More information about the Python-list