piotr luszczek :: python language wrapper

overview

python language wrapper (plw) translates python code into c code. it allows to include c code directly in the python code: such inlined c code is inserted into the translated code. here is an example:
def RandomAccess(table, n):
  """
  PLW[C]{
  int i, N, Ran=1, *Table;
  PLW[C]}
  """

  ran = numarray.array(1, type=numarray.Int32)
  """
  PLW[C]{
  N = plw_int_to_long(n);
  Table = (int *)plw_numarray_obj(table)->data;
  for (i = N; i; --i) {
    Ran = (Ran << 1) ^ ((Ran < 0) ? 7 : 0);
    Table[Ran & (N-1)] ^= Ran;
  }
  PLW[C]}
  """
  for i in range(n):
    ran = (ran << 1) ^ (numarray.any(ran < 0) and 7 or 0)
    table[ran & (n-1)] ^= ran

download

version 0.1 (may 1, 2007)
plw-0.1.tar.bz2

license

the code is distributed under the mit license.

translations

View this page in Romanian courtesy of azoft

View this page in Portegese courtesy of Artur Weber

View this page in Hindi courtesy of Dealsdaddy