No trees in the stdlib?

Paul Rubin http
Mon Jun 29 01:41:46 EDT 2009


João Valverde <backup95 at netcabo.pt> writes:
> Interesting, thanks. The concept is not difficult to understand but
> I'm not sure it would be preferable. A copy operation should have the
> same cost as a "snapshot", 

You mean a deep-copy?  That is unnecessarily expensive; with a
functional structure you can snapshot (or copy) by copying a single
pointer.

> undo is kind of redundant and multithreading... don't see a
> compelling use that would justify it. 

Here is one:
 http://groups.google.com/group/comp.lang.python/msg/1fbe66701e4bc65b

> Have you considered how the syntax would work in Python by the way? This:
> new_tree = old_tree.insert(object)
> Just looks wrong. 

It looks fine to me.  Obviously you could support a wrapper with
a mutating slot that holds a pointer to the tree.



More information about the Python-list mailing list