Logo

Programming-Idioms

  • Python
  • Pascal

Idiom #127 Source code inclusion

Import the source code for the function foo body from a file "foobody.txt".

procedure foo;
begin
  {$I foobody.txt}
end;
import imp
foo = imp.load_module('foobody', 'foobody.txt').foo

To remove all side-effects: del sys.modules['foobody']
void foo()
{
#include "foobody.txt"
}

Same as C++

New implementation...
< >
MLKo