[Python-ideas] Inline Function - idea

Alex Rodrigues lemiant at hotmail.com
Tue Feb 18 18:07:20 CET 2014


> Alex, can you explain the difference (if any) between your proposal and dynamic scoping?
>
> -- Steven

Inline functions would be a bit like dynamic scoping and a bit like macros. The main difference from dynamic scoping is that they would not search up beyond their parent to find names, since they act exactly like code injected at the spot they are called it is expected that the variables they are using (like the ones in it's parent) are either locals or globals. I'm not sure that that has many advantages outside of demanding less from the runtime, but that's how I imagined it. IMO The biggest advantage to inline functions over other constructs is ease of understanding. We may you be used to understanding scoping after lots of programming, but it's not always intuitive. On the other hand it is extremely intuitive to understand "when you call this, all that code runs exactly as if you had typed it here".

- Alex 		 	   		  


More information about the Python-ideas mailing list