None

Werner Schiendl ws-news at gmx.at
Tue Oct 23 17:00:16 EDT 2001


Hi,

just had to try that out...

>>> print None
None
>>> None = 17
>>> print None
17
>>>

Strange... is it intended that you can assign to None?

In short, is this a bug or a feature?

thanks
Werner

"Bjorn Pettersen" <BPettersen at NAREX.com> wrote in message
news:mailman.1003861644.23456.python-list at python.org...
> 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