Address-Of operator equivalent, PAVL search tree

castironpi castironpi at gmail.com
Fri Aug 22 00:03:25 EDT 2008


Hi,

I am translating the GNU library's PAVL search tree implementation
into Python.  I can't use it directly because a delete function I need
uses a different method of finding the node to delete.

It contains this line:

      q = (struct pavl_node *) &tree->pavl_root;

line 276 in http://www.sfr-fresh.com/unix/misc/avl-2.0.3.tar.gz:a/avl-2.0.3/pavl.c
for definition

  struct pavl_node *q; /* Parent of |p|. */

I want to know the equivalent in Python.  I observe that

      q = &tree->pavl_root;

is a type error and

      q = tree->pavl_root;

gives wrong results.  Is there any way I can use the existing code, or
will it require heavy modification?  It is possible to wrap it in a
DLL, (which I am considering for other reasons too), but I would
prefer a pure Python implementation.

Thanks in advance.



More information about the Python-list mailing list