None assigment

Simon Brunning SBrunning at trisystems.co.uk
Thu Feb 8 12:34:37 EST 2001


> From:	Gregoire Welraeds [SMTP:greg at perceval.be]
> > After doing "None = 2", you can "del None" to get the default value 
> > back.
 
Hmm. This is true - I didn't know that.
 
> If we follow that logic, I could use any non assigned variable to have the
> following working:
> 
> >>> a= [1,'',3]
> >>> filter(b,a)
> 
> but this won't work as the interpreter complains that there is no variable
> named b.
 
You can't do this with *ordinary* labels - by del'ing them, you are
un-assigning them. But the 'None' label is *extraordinary*, obviously.
 
> It seems that (the so called variable) None is neither a variable like any
> other, nor is it a label as stated by Simon Brunning in another post.
 
It *is* a label - try this:

>>>print None
None
>>> None = 'spam'
>>> print None
spam

So, clearly, None is a label.
 
	 Now that I look at this problem, I'm totally confused about None.
Any
> explanaition is welcome. Anyway, I don't understand that one can override
> None. Could you give me at least one single good reason to do that.
 
I can give you a good reason *not* to - it will confuse the hell out of
people. ;-)

I'm sure one of the Python gurus will give you a bit more background, but I
think that the short answer is this - leave 'None' alone to get on with its
job, and you won't have any problems.

Cheers,
Simon Brunning
TriSystems Ltd.
sbrunning at trisystems.co.uk




-----------------------------------------------------------------------
The information in this email is confidential and may be legally privileged.
It is intended solely for the addressee. Access to this email by anyone else
is unauthorised. If you are not the intended recipient, any disclosure,
copying, distribution, or any action taken or omitted to be taken in
reliance on it, is prohibited and may be unlawful. TriSystems Ltd. cannot
accept liability for statements made which are clearly the senders own.




More information about the Python-list mailing list