[Python-Dev] Re: Compiler treats None both as a constant and variable (original) (raw)
Terry Reedy tjreedy@udel.edu
Sat, 29 Mar 2003 16:41:54 -0500
- Previous message: [Python-Dev] Compiler treats None both as a constant and variable
- Next message: [Python-Dev] Compiler treats None both as a constant and variable
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
"Raymond Hettinger" <raymond.hettinger@verizon.net> wrote in message news:002001c2f636$77ad2ce0$e60ca044@oemcomputer...
>>> def f(): None
>>> dis(f) 2 0 LOADGLOBAL 0 (None) 3 POPTOP 4 LOADCONST 0 (None) 7 RETURNVALUE >>> None = 1 :1: SyntaxWarning: assignment to None >>> f() == None False
Is this a bug?
If one understands (as I do) the default return 'None' to mean the singleton NoneType object that the name 'None' is assumed to be bound to in the docs and which it is bound to on startup, then no.
Should the compiler use the GLOBAL in both places? Or, is it reasonable to use CONST in both places?
I understood the latter to be the plan after a sufficient warning period.
TJR
- Previous message: [Python-Dev] Compiler treats None both as a constant and variable
- Next message: [Python-Dev] Compiler treats None both as a constant and variable
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]