None, False, True

Duncan Booth duncan at NOSPAMrcp.co.uk
Thu Sep 18 04:34:34 EDT 2003


Gregor Lingl <glingl at aon.at> wrote in news:3F68CB67.5000409 at aon.at:

> On the other side the existence and knowledge of the None-object
> doesn't disappear completely in the plain Python interpreter:
> 
> >>> None = 3
><stdin>:1: SyntaxWarning: assignment to None
> >>> None
> 3
> >>> def f():
> ...     pass
> ...
> >>> print f()
> None
> 
> But:
> 
> >>> def g():
> ...     return None
> ...
> >>> g()
> 3
> 
> So you can use f to restore the value of None
> (if you happened to forget to save it):
> 
> >>> None = f()
><stdin>:1: SyntaxWarning: assignment to None
> >>> None
> >>> print None
> None

Or, much more easily, you could simply use 'del None' to remove the global 
None you defined leaving the builtin None visible again.

-- 
Duncan Booth                                             duncan at rcp.co.uk
int month(char *p){return(124864/((p[0]+p[1]-p[2]&0x1f)+1)%12)["\5\x8\3"
"\6\7\xb\1\x9\xa\2\0\4"];} // Who said my code was obscure?




More information about the Python-list mailing list