[Python-Dev] Making None a keyword (original) (raw)

Fred L. Drake, Jr. fdrake@acm.org
Fri, 26 Apr 2002 10:24:04 -0400


Jeremy Hylton writes:

I don't understand what you mean, but I'll try to reply anyway :-).

Often a good tactic. ;-)

I assume LOAD_NONE will eliminate the need for LOAD_CONST 0 (None).

Yes.

It's probably a wee bit faster and it makes the bytecode smaller, because you don't need None in co_consts and you don't need an argument to the bytecode.

Yes.

Based on my cycle counter measurements before the conference, I suspect the performance impact is, well, negligible.

Regarding changing LOAD_CONST 0 to LOAD_NONE, yes. What's more interesting are the changes of LOAD_GLOBAL 'None' to one of LOAD_CONST 0 or LOAD_NONE. That could be changed to use LOAD_CONST 0 now, without adding a new bytecode, and we could get a better idea of how much performance it actually buys us in practice, since we get rid of two dict lookups (globals & builtins).

That doesn't address the deprecation cycle, but it would be nice to see what the change would buy us.

-Fred

-- Fred L. Drake, Jr. PythonLabs at Zope Corporation