<div>trying again, this email address was apparently not on the list:</div><div><br></div><span style="font-family:arial,sans-serif;font-size:13px">My experience dealing with trees is always that the "tree" part is always so simple that it isn't a big deal to re-implement it.  The problem is dealing with all of the extra stuff that you need and the details of what happens when you do different operations.  I think it makes more sense to have an interface for a kind of thing you want to do with a tree (e.g. sorted sets, or ordered maps) rather than the tree itself.</span><br>
<div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Dec 19, 2012 at 10:55 AM, Jeff Jenkins <span dir="ltr"><<a href="mailto:jeff@jeffreyjenkins.ca" target="_blank">jeff@jeffreyjenkins.ca</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">My experience dealing with trees is always that the "tree" part is always so simple that it isn't a big deal to re-implement it.  The problem is dealing with all of the extra stuff that you need and the details of what happens when you do different operations.  I think it makes more sense to have an interface for a kind of thing you want to do with a tree (e.g. sorted sets, or ordered maps) rather than the tree itself.<div class="gmail_extra">

<br><br><div class="gmail_quote"><div><div class="h5">On Wed, Dec 19, 2012 at 10:11 AM, anatoly techtonik <span dir="ltr"><<a href="mailto:techtonik@gmail.com" target="_blank">techtonik@gmail.com</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">
<div dir="ltr"><div class="gmail_extra">On Sun, Dec 16, 2012 at 6:41 PM, Guido van Rossum <span dir="ltr"><<a href="mailto:guido@python.org" target="_blank">guido@python.org</a>></span> wrote:<br><div class="gmail_quote">



<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">I think of graphs and trees as patterns, not data structures.</blockquote>



<div><br></div><div>In my world strings, ints and lists are 1D data types, and tree can be a very important 2D data structure. Even if it is a pattern, this pattern is vital for the transformation of structured data, because it allows to represent any data structure in canonical format.</div>



<div><br></div><div>Speaking of tree as a data structure, I assume that it has a very basic definition:</div><div><br></div><div>1. tree consists of nodes<br></div><div>2. some nodes are containers for other nodes</div>

<div>3. every node has properties</div><div>4. every node has 0 or 1 parent</div><div>5. every container has 1+ children</div><div><div>6. tree has a single starting root node</div><div>7. no child of a parent can be its ancestor</div>



<div>   (no cyclic dependencies between elements)</div><div><br></div></div><div>List of trees is a forest. Every subtree is a complete tree.</div><div><br></div><div><br></div><div>To see which tree data type would be really useful in Python distribution (e.g. provides a simple, extendable and intuitive interface), I see only one way - is to scratching some itches relevant to Python and then try to scale it to other problems. The outcome should be the answer - what for native tree type is not suitable?</div>



<div><br></div><div>More ideas:</div><div>[ ] Much experience for working with trees can be brought from XML and DOM manipulation practices (jQuery and friends)</div><div>  [ ] every element in a tree can be accessed by its address specificator as 'root/node[3]/last'</div>



<div>  [ ] but it is also convenient to access tree data using node names as 'mylib.books[:1]'</div><div>  [ ] and of course, you can run queries over trees</div><div><br></div><div>[ ] Tree is the base for any "Data Transformation Framework" as it allows to jump from "data type conversion" to "data structure conversion and mapping"</div>



<div>  [ ] Trees can be converted to other trees and to more complicated structures</div><div>  [ ] Conversion can be symmetrical and non-symmetrical</div><div>  [ ] Conversion can be lossy and lossless</div>

<div>  [ ] Conversion can be lossless and non-symmetrical at the same time</div><div><br></div><div>Trees can be used, for example, for realtime migration of issues from one tracker to another. For managing changesets with additional meta information. For presenting package dependencies and working with them. For atomic (transactional) file management. For managing operating system capability information. For logging setup. For debugging structures in Python. For working and converting binary file formats. For the common AST transformation and query interface. For the understanding how 2to3 fixers work. For the common ground of visual representation, comparison and transformation of data structures. That's probably enough of my itches.</div>



</div></div></div>
<br></div></div>_______________________________________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org" target="_blank">Python-ideas@python.org</a><br>
<a href="http://mail.python.org/mailman/listinfo/python-ideas" target="_blank">http://mail.python.org/mailman/listinfo/python-ideas</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br></div>