#16215: A missing "import" in DiGraph
-------------------------+-------------------------------------------------
       Reporter:         |        Owner:
  ncohen                 |       Status:  needs_work
           Type:         |    Milestone:  sage-6.2
  enhancement            |   Resolution:
       Priority:  major  |    Merged in:
      Component:  graph  |    Reviewers:  Vincent Delecroix
  theory                 |  Work issues:
       Keywords:         |       Commit:
        Authors:         |  7f50072dc0ab7cd38e5a2af14534b4ce012fa9f2
  Nathann Cohen          |     Stopgaps:
Report Upstream:  N/A    |
         Branch:         |
  u/ncohen/16215         |
   Dependencies:         |
-------------------------+-------------------------------------------------
Changes (by vdelecroix):

 * status:  needs_review => needs_work
 * reviewer:   => Vincent Delecroix


Old description:

> {{{
> sage: Graph([(0,1),(0,1)],multiedges=False)
> ValueError: Non-multigraph input dict has multiple edges (0,1)
> sage: DiGraph([(0,1),(0,1)],multiedges=False)
> ...
> NameError: global name 'choice' is not defined
> }}}
>
> The first message is much clearer `:-P`
>
> Nathann

New description:

 {{{
 sage: Graph([(0,1),(0,1)],multiedges=False)
 Traceback (most recent call last):
 ...
 ValueError: Non-multigraph input dict has multiple edges (0,1)
 sage: DiGraph([(0,1),(0,1)],multiedges=False)
 Traceback (most recent call last):
 ...
 NameError: global name 'choice' is not defined
 }}}

 The first message is much clearer `:-P`

 Nathann

--

Comment:

 Could you instead replace
 {{{
 choice([v for v in data[u] if data[u].count(v) > 1])
 }}}
 with
 {{{
 (v for v in data[u] if data[u].count(v) > 1).next()
 }}}
 or anything similar. The function `choice` involves some randomness that
 is useless here.

--
Ticket URL: <http://trac.sagemath.org/ticket/16215#comment:3>
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/d/optout.

Reply via email to