#15704: Stupid waste of time in graphs 1
-------------------------+-------------------------------------------------
       Reporter:         |        Owner:
  ncohen                 |       Status:  needs_review
           Type:         |    Milestone:  sage-6.1
  enhancement            |   Resolution:
       Priority:  major  |    Merged in:
      Component:  graph  |    Reviewers:
  theory                 |  Work issues:
       Keywords:         |       Commit:
        Authors:         |  ce049ba02d81d3208fb33ac54579d6690468a636
  Nathann Cohen          |     Stopgaps:
Report Upstream:  N/A    |
         Branch:         |
  u/ncohen/15604         |
   Dependencies:         |
-------------------------+-------------------------------------------------

Comment (by ncohen):

 Yo !

 > I think you should have something documenting what happens with the old
 "bad" behavior.  I assume it raises a well-formed error that tells people
 exactly what to do?

 Well, it raises the same error as `u,v=1`. To be honest I was afraid of
 adding a try/catch around the loop for the exception is a `ValueError`,
 and I don't it to catch a `ValueError` in `_backend.add_edge` if there is
 one.

 {{{
 sage: g = Graph()
 sage: g.add_edges([(0,1),(0,1,1)])
 ---------------------------------------------------------------------------
 ValueError                                Traceback (most recent call
 last)
 <ipython-input-4-edffa551e119> in <module>()
 ----> 1
 g.add_edges([(Integer(0),Integer(1)),(Integer(0),Integer(1),Integer(1))])

 /home/ncohen/.Sage/local/lib/python2.7/site-
 packages/sage/graphs/generic_graph.pyc in add_edges(self, edges)
    8970         else:
    8971             self._backend.add_edge(e0[0], e0[1], None,
 self._directed)
 -> 8972             for u,v in it:
    8973                 self._backend.add_edge(u, v, None, self._directed)
    8974

 ValueError: too many values to unpack
 }}}

 I hope it will be explicit enough for the users, and that they will notice
 they feed the loop with heterogeneous data.

 As for testing `add_edges()` with only pairs, not only it is still
 supported but I think most calls to this function only feed pairs `:-P`

 I added a commit.

 Nathann

--
Ticket URL: <http://trac.sagemath.org/ticket/15704#comment:5>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to