None

Larry Whitley ldw at us.ibm.com
Tue Oct 23 14:01:09 EDT 2001


I want to have a methode of a class that will take the argument of a file
object that has previously been opened for write and be able to call it,
directing it's output to a file, or directing the output to standard output.

def output(self, fout):
    print >>fout, self.thing1, self.thing2, self.thing3

In the calling program I say:

object.output( fout ) # print to file
object.output( None) # print to standard output

But Python complains that None is a variable that has not been previously
set.  Can someone explain?  I thought None was the empty object reference.
Where have I gone astray?

Larry





More information about the Python-list mailing list