[Python-ideas] Graph class

Nick Coghlan ncoghlan at gmail.com
Tue Dec 18 04:26:38 CET 2012


On Mon, Dec 17, 2012 at 9:28 AM, Hannu Krosing <hannu at krosing.net> wrote:

>  On 12/16/2012 04:41 PM, Guido van Rossum wrote:
>
> I think of graphs and trees as patterns, not data structures.
>
>
> How do you draw line between what is data structure and what is pattern ?
>

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.

More generally, ABCs and magic methods are used to express patterns (like
iteration), which may be implemented by various data structures.

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.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20121218/cff3927b/attachment.html>


More information about the Python-ideas mailing list