Tim Peters <t...@python.org> added the comment:

Possibly, sure.  But I believe it's hard to beat

    add(node, *predecessors)

for usability as a way to build the dependency graph.  For example, a list of 
pairs is a comparative PITA for most use cases I've had.  Whether it's 
following a recipe to bake a cake, or tracing a maze of C include files, it 
seems _most_ natural to get input in the form "this thing depends on these 
other things".  Not the other way around, and neither a sequence of pairs.

_If_ you buy that, then .add() is screamingly natural, and trying to squash a 
pile of .add()s into a single sequence-of-sequences argument seems strained.

Typically I don't get input in one big, single gulp.  It's instead discovered 
one item at a time.  Fine - .add() it and then move on to the next item.  It's 
certainly possible to append the item and its predecessors to a persistent 
(across items) list, and call a function once at the end with that list.

But what does that buy?  I'm building the list solely to meet the function's 
input requirement - the list serves no other purpose.  Instead of calling 
.add() N times, I call .append() N times.  "add" is 3 letters shorter ;-)

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue17005>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to