None

Bjorn Pettersen BPettersen at NAREX.com
Tue Oct 23 14:26:16 EDT 2001


> From: Larry Whitley [mailto:ldw at us.ibm.com] 
> 
> 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?

Not enough information (although I'm assuming you're assigning to None
somewhere...) Could you post your traceback?

-- bjorn




More information about the Python-list mailing list