How about RETURN_NONE vs LOAD_CONST 0 (None); RETURN_VALUE ?

Martin v. Löwis martin at v.loewis.de
Thu Dec 12 01:51:53 EST 2002


bokr at oz.net (Bengt Richter) writes:

> The boilerplate always returns None, so why not minimize the boilerplate
> to one byte code? 

See python.org/sf/587993. RETURN_NONE was implemented, then taken out
again. Ask Google for RETURN_NONE, there are plenty of prior
discussions.

> E.g., when would it be unsafe to eliminate it if the last statement
> in the function is a return at indent level 1 ?

That would be safe, yes. Did you try to implement it?

Regards,
Martin



More information about the Python-list mailing list