You could add (at the price of some speed)
from sage.misc.functional import round
Le jeudi 31 janvier 2019 08:42:24 UTC+1, David Coudert a écrit :
>
> Does anyone know a suitable way to fix the following issue with round in
> Python3 ?
>
> sage: G = Graph([(0, 1)])
> sage: f = g._build_flow_graph({(0, 1): 1}, True)
> ---
> TypeError Traceback (most recent call last)
> in ()
> > 1 f = g._build_flow_graph({(Integer(0), Integer(1)): Integer(1)},
> True)
>
> /Users/dcoudert/sage3/sage/local/lib/python3.6/site-packages/sage/graphs/generic_graph.py
>
> in _build_flow_graph(self, flow, integer)
>9094 g.delete_edge(u, v)
>9095 else:
> -> 9096 g.set_edge_label(u, v, int(round(l)))
>9097
>9098 # returning a graph with the same embedding, the
> corresponding name, etc ...
>
> TypeError: type sage.rings.integer.Integer doesn't define __round__ method
> sage:
> sage: f = g._build_flow_graph({(0, 1): 1.0}, True)
> ---
> TypeError Traceback (most recent call last)
> in ()
> > 1 f = g._build_flow_graph({(Integer(0), Integer(1)):
> RealNumber('1.0')}, True)
>
> /Users/dcoudert/sage3/sage/local/lib/python3.6/site-packages/sage/graphs/generic_graph.py
>
> in _build_flow_graph(self, flow, integer)
>9094 g.delete_edge(u, v)
>9095 else:
> -> 9096 g.set_edge_label(u, v, int(round(l)))
>9097
>9098 # returning a graph with the same embedding, the
> corresponding name, etc ...
>
> TypeError: type sage.rings.real_mpfr.RealLiteral doesn't define __round__
> method
>
>
--
You received this message because you are subscribed to the Google Groups
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.