<div class="gmail_quote">On Mon, Dec 17, 2012 at 9:28 AM, Hannu Krosing <span dir="ltr"><<a href="mailto:hannu@krosing.net" target="_blank">hannu@krosing.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

  
    
  
  <div text="#000000" bgcolor="#FFFFFF"><div class="im">
    <div>On 12/16/2012 04:41 PM, Guido van
      Rossum wrote:<br>
    </div>
    <blockquote type="cite">I think of graphs and trees as patterns, not data
      structures.<span></span><br>
    </blockquote>
    <br></div>
    How do you draw line between what is data structure and what is
    pattern ?<br></div></blockquote><div><br>A rough rule of thumb is that if it's harder to remember the configuration options in the API than it is to just write a purpose-specific function, it's probably better as a pattern that can be tweaked for a given use case than it is as an actual data structure.<br>
<br>More generally, ABCs and magic methods are used to express patterns (like iteration), which may be implemented by various data structures.<br><br>A graph library that focused on defining a good abstraction (and adapters) that allowed graph algorithms to be written that worked with multiple existing Python graph data structures could be quite interesting.<br>
<br>Cheers,<br>Nick.<br clear="all"></div></div><br>-- <br>Nick Coghlan   |   <a href="mailto:ncoghlan@gmail.com">ncoghlan@gmail.com</a>   |   Brisbane, Australia<br>