[Python-Dev] Compiler treats None both as a constant and variable
Raymond Hettinger
Raymond Hettinger" <python@rcn.com
Sat, 29 Mar 2003 16:02:10 -0500
Sat, 29 Mar 2003 16:02:10 -0500
- Previous message: [Python-Dev] Re: Fast access to __builtins__
- Next message: [Python-Dev] Re: Compiler treats None both as a constant and variable
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
>>> def f():
None
>>> dis(f)
2 0 LOAD_GLOBAL 0 (None)
3 POP_TOP
4 LOAD_CONST 0 (None)
7 RETURN_VALUE
>>> None = 1
<stdin>:1: SyntaxWarning: assignment to None
>>> f() == None
False
Is this a bug?
Should the compiler use the GLOBAL in both places?
Or, is it reasonable to use CONST in both places?
Raymond Hettinger
- Previous message: [Python-Dev] Re: Fast access to __builtins__
- Next message: [Python-Dev] Re: Compiler treats None both as a constant and variable
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]